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

Need to build my own message from cz.jirutka.rsql.parser.ParseException #47

Open
guptapavan31 opened this issue Apr 13, 2021 · 1 comment

Comments

@guptapavan31
Copy link

My application is taking RSQLParserException and converting it to our application specific application.

Now the message created from ParseException::initialise is not usable by our application and I wanted to create my own message using its 3 properties. Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal

I am able to use expectedTokenSequencesVal and tokenImageVal, but since cz.jirutka.rsql.parser.Token is not the public class I am unable to use currentTokenVal. Is cz.jirutka.rsql.parser.Token Intentionally not a public class. Is there alternative way to overwrite ParseException::initialise or some way I can create my own message.

@GLinBoy
Copy link

GLinBoy commented Sep 10, 2021

Can you catch this exception and try to convert it to your exception with your own message? is it possible?
I mean put that part in a try/catch block and in the catch block, throw your exception, something like this:

try {
	Node rootNode = new RSQLParser().parse(query);
	spec = rootNode.accept(new CustomRsqlVisitor<Product>());
} catch (RSQLParserException ex) {
	throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Dude, yor query is wrong! check it and try again :)");
}

What do think? May it help you? 🤔

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

No branches or pull requests

2 participants