You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a service using Quarkus 2.16.4.Final and resteasy-reactive. Inside of a ContainerResponseFilter, I want to access the Exception that was thrown by my service code. In Jersey 1.x, there used to be a ContainerResponse.getMappedThrowable() which provided this.
From digging in the ContainerResponseContextImpl, the ResteasyReactiveRequestContext does have what I need in its throwable field, accessible from getThrowable(). However, the ContainerResponseContextImpl doesn't expose the ResteasyReactiveRequestContext, so I don't know how to get a reference to the throwable. It's not in the JAXRS API, I'm not sure where that method was moved from 1.x to 2.x.
Is there another way to do this, or is this a feature request?
Sample filter method, for illustration purposes:
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
MyData data = (MyData) requestContext.getProperty(PROPERTY_KEY);
ContainerResponseContextImpl impl = (ContainerResponseContextImpl) responseContext;
if (isFailureException(...)) { // How to get the exception? In Jersey 1.x this was accessed by ContainerResponse.getMappedThrowable().
data.onFailed();
}
}
For now, I'm using reflection to poke into the ContainerResponseContextImpl.context.throwable, but surely there must be a better way 😅
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a service using Quarkus 2.16.4.Final and resteasy-reactive. Inside of a
ContainerResponseFilter
, I want to access the Exception that was thrown by my service code. In Jersey 1.x, there used to be aContainerResponse.getMappedThrowable()
which provided this.From digging in the
ContainerResponseContextImpl
, theResteasyReactiveRequestContext
does have what I need in its throwable field, accessible fromgetThrowable()
. However, theContainerResponseContextImpl
doesn't expose theResteasyReactiveRequestContext
, so I don't know how to get a reference to the throwable. It's not in the JAXRS API, I'm not sure where that method was moved from 1.x to 2.x.Is there another way to do this, or is this a feature request?
Sample filter method, for illustration purposes:
For now, I'm using reflection to poke into the ContainerResponseContextImpl.context.throwable, but surely there must be a better way 😅
Beta Was this translation helpful? Give feedback.
All reactions