Open CapsAdmin opened 3 years ago
I started doing this and it feels easier to me to read than i was expecting. Especially when it's split in newlines.
At the moment, this case is obviously too verbose
_G does not contain "Token"
because "Token" is not the same value as "__name"
"Token" is not the same value as "return_type"
"Token" is not the same value as "argument_type"
"Token" is not the same value as "exclude"
"Token" is not the same value as "Tuple"
"Token" is not the same value as "enum"
"Token" is not the same value as "error_inside_base_environment"
"Token" is not the same value as "keysof"
"Token" is not the same value as "type_assert"
"Token" is not the same value as "subset_of"
-- ETC
I'm thinking I should embrace verbosity and then simplify the message when displaying the error.
Random quick thought, maybe even use a "language" that is easily parsable that then generates the proper error in English.
"Token" not in _G:
_G["Token"] != "__name",
_G["Token"] != "__name",
_G["Token"] != "__name",
-- ETC
At the moment error messages are a bit all over the place. In some cases the token nodes that the error points to is also not always correct.
I've thought about representing errors with a "because chain", not sure if this is practically useful or if it's just a neat idea. Something like this:
It's a bit similar to a stack trace. The problem I have with stack traces is that it's not always useful to see all of the stack, but figuring out which level to cut out is not easily solvable.