KoffeinFlummi / armake2

Successor to armake written in Rust
GNU General Public License v2.0
49 stars 17 forks source link

Improve Error system #13

Open jonpas opened 5 years ago

jonpas commented 5 years ago

Example:

error: Failed to build PBO:
Failed to parse config:
In line addons/weapon_sniper_c/config.cpp:19:

  class CfgSoundShaders {
  ^

Unexpected token "", expected: "delete", "[a-zA-Z0-9_]", "class"

The Failed to build PBO: with the colon at the end is very confusing, as one expects to read the PBO name there. However that is a job of whatever is using/calling armake2. Same goes for further lines until the actual source.

An idea would be to prepend those with a number, it's supposed to be kind of a stack trace if I understand the meaning of this form of error output, numbers like Rust's backtrace would be ideal. And obviously no colons in that case.

It's also self-explanatory that PBO failed to build if you have a red error which also tells you what what exactly failed (parsing, binarizing... etc.).

KoffeinFlummi commented 5 years ago

I removed some of the more general top-level error messages, but I think the error system needs an overhaul anyways. Rust has the tools to build a proper Error stack, which would be more useful when using armake as a library as well.