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

Missing ; in flux file when using Flux/main throws no exception #421

Closed
katauber opened this issue Nov 17, 2021 · 3 comments · Fixed by #438
Closed

Missing ; in flux file when using Flux/main throws no exception #421

katauber opened this issue Nov 17, 2021 · 3 comments · Fixed by #438

Comments

@katauber
Copy link
Member

In the implementation of metafacture/metafacture-playground#50 I found out, when using the Flux/main method to process a flux file, that a missing ; at the end of the flux file does not throw an exception. In the console is printed
line 0:-1 mismatched input '<EOF>' expecting ';'

dr0i added a commit that referenced this issue Jan 14, 2022
If a RecognitionException occurs in FluxParser it was catched. So callers had
no chance to be aware of the Exception.
As it's not possible to create a new RecognitionException with a customized
error message (and throw this new RecognitionException) and also to be
backwards compatibel (RuntimeException are referred to as unchecked exceptions
and the code would compile just as before) no checked Exception was used but
a RuntimeException with the customized error message.
dr0i added a commit that referenced this issue Jan 14, 2022
If a `RecognitionException` occurs in `FluxParser` it was catched. So callers had
no chance to be aware of the Exception.
As it's not possible to create a new `RecognitionException` with a customized
error message (and throw this new `RecognitionException`) and also to be
backwards compatibel (`RuntimeExceptions` are referred to as unchecked exceptions
and the code would compile just as before) no checked Exception is thrown but
a `RuntimeException` with the customized error message.
@dr0i dr0i linked a pull request Jan 14, 2022 that will close this issue
@dr0i
Copy link
Member

dr0i commented Jan 14, 2022

Deployed to test, see http://test.lobid.org/playground/.

@katauber
Copy link
Member Author

Yes, great! That works :)

@katauber katauber removed their assignment Jan 18, 2022
dr0i added a commit that referenced this issue Jan 20, 2022
blackwinter added a commit that referenced this issue Jan 20, 2022
All `RecognitionException`s are finally caught in the `flux` catch handler which can then take the appropriate measures.
dr0i added a commit that referenced this issue Feb 3, 2022
This guarantees (more) exceptions to be thrown. Note that it isn't sufficient to
just add a default (or: minimal) catch handler to all expressions, e.g. adding
that to the 'atom' expression would result in an not detailed enough message.

The overriding of 'recoverFromMismatchedToken' guarantees the throwing of an
exception when attempting a recover (before that would be reported but not thrown (see
metafacture/metafacture-playground#84 )).

- use 'FluxParseException' instead of 'RuntimeException'
- add some more tests
@dr0i dr0i closed this as completed in #438 Feb 7, 2022
@dr0i
Copy link
Member

dr0i commented Feb 7, 2022

Should be automatically deployed tomorrow morning.

dr0i added a commit that referenced this issue Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants