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

Ability to customize error messages #553

Open
driverpt opened this issue Aug 18, 2023 · 3 comments
Open

Ability to customize error messages #553

driverpt opened this issue Aug 18, 2023 · 3 comments
Labels
type: enhancement New feature or request

Comments

@driverpt
Copy link

driverpt commented Aug 18, 2023

Feature description

Currently we obtain something like:

Unable to decode request body: Error decoding JSON stream for type [res]: Error decoding property [<some class> property1] of type [class <some class>]: Error decoding property [<some other class> property1] of type [class <some other class>]: Unexpected token VALUE_STRING, expected START_OBJECT

We wanted to be able to customize something like:

Invalid json for <fieldName> for class <class name>
@yawkat
Copy link
Member

yawkat commented Aug 18, 2023

You can customize the error handling https://docs.micronaut.io/latest/guide/index.html#errorHandling

@driverpt
Copy link
Author

Is it possible to add the Target Class to the Exception?

@yawkat
Copy link
Member

yawkat commented Aug 23, 2023

atm the type is part of the message but not exposed as a field on the SerdeException. we could add a subtype that makes this accessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants