How to implement global exception handler in Kotlin? #7496
Unanswered
jehrenzweig-leagueapps
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The annotation part of your problem is solved by this syntax: @Requires(classes = [RuntimeException::class]) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to return a custom exception object when any of my Micronaut implementation methods throws an unhandled exception. I've seen the guide on how to do it using Java, but I'm stumbling when I try to implement this approach using Kotlin.
Here's what my code currently looks like:
The
GlobalExceptionHandler
class that I've declared never gets called right now, if/when an API controller method throws an exception. Am I missing a step (or few) somewhere?Beta Was this translation helpful? Give feedback.
All reactions