FasterXML / FasterXML/jackson-future-ideas
Implement user friendly exceptions
- Dominant language
- No language data
- Stars
- 21
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice if we could generate user-friendly exceptions from `JacksonMappingException`s. Here is an example exception:
```
com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class io.rakam.ui.service.recipe.Recipe$ExportDashboard] value failed for JSON property name due to missing (therefore NULL) value for creator parameter name which is a non-nullable type
at [Source: (String)"{"fname":"Events Overview","category":"Segment Events","filterSchema":[{"name":"dateRange","type":"mappingDimension","value":{"name":"eventTimestamp"},"defaultValue":"P5Y","isRequired":true}],"reports":[{"name":"Events by Last Seen App Version","ttl":"PT1H","x":0,"y":3,"h":2,"w":6,"component":"r-segmentation-table","type":1,"reportOptions":{"modelName":"segment_events","dimensions":[{"name":"event_text","modelName":"segment_events","relationName":null,"postOperation":null}],"measures":[{"name":""[truncated 2664 chars]; line: 1, column: 3164] (through reference chain: io.rakam.ui.service.recipe.Recipe$ExportDashboard["name"])
```
Something like the following message that includes JsonPath would be much more helpful to the users:
```
Parameter .name is required.
```
We're currently doing this in our web application but since the data mappers have their own exceptions, we need to handle many different cases. It might be a good practice if `JsonMappingException` could have a method such as `getUserFriendlyMessage` that allows developers to do it in data-mappers.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.