Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor error message #248

Closed
7 tasks done
senier opened this issue May 19, 2020 · 2 comments · Fixed by #285
Closed
7 tasks done

Refactor error message #248

senier opened this issue May 19, 2020 · 2 comments · Fixed by #285
Assignees

Comments

@senier
Copy link
Member

senier commented May 19, 2020

We hardly have any source location in our error messages that could be used by and IDE to point the user to the source of an error.

  • Introduce Location class (file, start line, start column, end line end column)
  • Add location to expression
  • Fill location in parser
  • Introduce base exception
    • has a list of errors
    • error has severity (error, warning, info), message and list of locations
  • Change all raised exceptions to derice from base exception
  • Change CLI to output <file>:<line>:<col> <severity> <message>
  • Review error handling for places to combine messages
@senier senier self-assigned this May 19, 2020
@treiher
Copy link
Collaborator

treiher commented May 19, 2020

It would be nice if not only the first detected error would be reported. Of course not all types of errors allow that (i.e. syntax errors), but in other cases this would increase the usability. I suppose the mechanism for reporting errors (currently exceptions) would have to be changed to achieve that.

@senier
Copy link
Member Author

senier commented May 19, 2020

That's a very good point. We'll probably only be able to continue checking in certain situations. E.g. performing more checks on a model which failed validation already will only produce more spurious errors. OTOH, checking other messages or files after an error in a different message/file could make sense. I'll see what I can do.

senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 26, 2020
senier pushed a commit that referenced this issue May 28, 2020
senier pushed a commit that referenced this issue May 28, 2020
senier pushed a commit that referenced this issue May 28, 2020
senier pushed a commit that referenced this issue May 28, 2020
senier pushed a commit that referenced this issue May 30, 2020
senier pushed a commit that referenced this issue May 30, 2020
senier pushed a commit that referenced this issue May 30, 2020
senier pushed a commit that referenced this issue May 30, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
When using an invalid package name for a refinement (say "A.B"), then
the expected error is supposed to be something like "A.B is not a valid
package name". For refinements, however, the super class is initialized
with

   package * "__REFINEMENT__"
   f"{flat_name(sdu.full_name)}__{flat_name(pdu.full_name)}__{field.name}__"

which produces some convoluted error message mentioning that long
internal string. Instead of filtering such situations in the super-class,
we now reinitialized the error buffer after initializing the super-class
of Refinement, effectively ignoring errors in the ID() constructor. The
well-formedness of the package identifier is checked separately.

Ref. #248, #285
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
The fix for #277 was actually not proper, as any contradiction would
be flagged as an error. However, as long as there is at least one
non-contradictory path, we cannot treat a field condition as
contradictory.

This problem occurred in the test, but was not discovered as the test
was missing a error.propagate() call after message construction. This
was noticed when making Message constructors raise exceptions again in
the discussion of #285.

Ref. #248
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants