-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix #4603 (Keep stacktrace when re-throwing exception with JsonMappingException) #5041
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
Conversation
Throwable th = ClassUtil.getRootCause(e); | ||
throw JsonMappingException.from(p, ClassUtil.exceptionMessage(th), th); | ||
} else { | ||
throw JsonMappingException.from(p, ClassUtil.exceptionMessage(e.getCause()), e.getCause()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thougths...
-
Calling
getCause()
because exception is InvocationTarget exception thrown from a setter method.
There maybe other cases? or nah -
How to centralize this handling? Or at least make it clean
/** | ||
* @since 2.19 | ||
*/ | ||
WRAP_EXCEPTIONS(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highly confusing since we already have SerializationFeature.WRAP_EXCEPTIONS
and DeserializationFeature.WRAP_EXCEPTIONS
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, will change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified to your original suggestion 👍🏼
@cowtowncoder May I ask what you think of this? |
@JooHyukKim Sorry, haven't had time to really think it through. My initial thinking though is that maybe this should wait for other work -- or ideally getting a test by submitted to ensure we know what exactly is being requested. I'll try to come back to this one soon & add more useful note wrt what I think. |
Quick note/question: #4603 is for Jackson 3.0, not 2.19. Too risky trying to do this with 2.x, not as much benefit. |
FWIW, I ran into something like this while working on #5046 - when |
Will re-create PR because of some rebase conflicts, to be safe. |
#5054 Re-based version |
#4603