guide-rest-intro icon indicating copy to clipboard operation
guide-rest-intro copied to clipboard

Consider providing guidance on exception handling

Open lmsurpre opened this issue 7 years ago • 1 comments

I used this guide to refresh my JAX-RS knowledge. Unfortunately, when I went to apply that, I was getting a 500 error back in my client but there was nothing useful in the server logs (even with debug tracing).

It turned out to be a dumb mistake on my part (ArrayOutOfBoundsException), but is there a suggested way for configuring a root exception handler so that future mistakes like that would at least get logged?

I ended up following the advice at https://stackoverflow.com/a/19680115/161022 to register an ExceptionMapper and inserted a log statement there. If that is the recommended approach, it might be nice to add something like that to this guide so that anyone starting from here will have unhandled exceptions logged for them. Let me know if I'm missing something!

lmsurpre avatar Aug 15 '18 22:08 lmsurpre

When running the application included in the guide using the goal mvn liberty:run or mvn liberty:dev logs are created in the directory target/liberty/wlp/usr/servers/defaultServer/logs. Errors appear in .log files generated there.

May be worth it to mention these logs, but this probably isn't a good way to handle this. Unsure if exception handling should be included in the intro guide or if it should be in its own guide.

AustinSeto avatar Jun 26 '20 20:06 AustinSeto