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

More meaningful exception for missing mandatory kotlin constructor params #32

Closed
jamesbassett opened this issue Jun 20, 2016 · 1 comment

Comments

@jamesbassett
Copy link

jamesbassett commented Jun 20, 2016

Hi, thanks so much for the kotlin module :)

Just wondering if it would be possible for KotlinValueInstantiator to throw a more specific exception for missing mandatory fields (i.e. mandatory kotlin constructor params)?

Our use case is that we're using kotlin data classes in our Spring Boot REST APIs. We've got some basic exception handling to provide more meaningful API errors when Jackson has an issue with the JSON (e.g. invalid enum values, invalid date formats, etc), but currently there's no easy way to identify missing mandatory values (i.e. mandatory kotlin constructor params), as it just throws a generic JsonMappingException.

I can't see a good fit among the existing exceptions, so it would have to be a new one, maybe MissingKotlinParameterException?

I've created a PR, see #33

jamesbassett pushed a commit to jamesbassett/jackson-module-kotlin that referenced this issue Jun 23, 2016
@apatrida
Copy link
Member

merged, next release will have it.

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