mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 08:41:22 +00:00
Fixes #3949
If a checked exception is thrown from an interceptor allow RESTeasy exception mappers to unwrap it.
This commit is contained in:
committed by
Guillaume Smet
parent
388847d2ef
commit
51debde577
@@ -35,6 +35,7 @@ import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import io.quarkus.arc.ArcUndeclaredThrowableException;
|
||||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
|
||||
import io.quarkus.arc.deployment.AnnotationsTransformerBuildItem;
|
||||
import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem;
|
||||
@@ -257,6 +258,8 @@ public class ResteasyServerCommonProcessor {
|
||||
resteasyInitParameters.put(ResteasyContextParameters.RESTEASY_GZIP_MAX_INPUT,
|
||||
Long.toString(commonConfig.gzip.maxInput.asLongValue()));
|
||||
}
|
||||
resteasyInitParameters.put(ResteasyContextParameters.RESTEASY_UNWRAPPED_EXCEPTIONS,
|
||||
ArcUndeclaredThrowableException.class.getName());
|
||||
|
||||
resteasyServerConfig.produce(new ResteasyServerConfigBuildItem(path, resteasyInitParameters));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.quarkus.arc.processor;
|
||||
import static org.objectweb.asm.Opcodes.ACC_FINAL;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
|
||||
|
||||
import io.quarkus.arc.ArcUndeclaredThrowableException;
|
||||
import io.quarkus.arc.InjectableInterceptor;
|
||||
import io.quarkus.arc.InvocationContextImpl.InterceptorInvocation;
|
||||
import io.quarkus.arc.Subclass;
|
||||
@@ -325,7 +326,7 @@ public class SubclassGenerator extends AbstractGenerator {
|
||||
if (addCatchException) {
|
||||
CatchBlockCreator catchOtherExceptions = tryCatch.addCatch(Exception.class);
|
||||
// and wrap them in a new RuntimeException(e)
|
||||
catchOtherExceptions.throwException(RuntimeException.class, "Error invoking subclass method",
|
||||
catchOtherExceptions.throwException(ArcUndeclaredThrowableException.class, "Error invoking subclass method",
|
||||
catchOtherExceptions.getCaughtException());
|
||||
}
|
||||
// InvocationContextImpl.aroundInvoke(this, methods.get("m1"), params, interceptorChains.get("m1"), forward)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.quarkus.arc;
|
||||
|
||||
/**
|
||||
* Exception that is thrown from generated arc classes if a checked exception cannot be propagated
|
||||
*/
|
||||
public class ArcUndeclaredThrowableException extends RuntimeException {
|
||||
|
||||
public ArcUndeclaredThrowableException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ArcUndeclaredThrowableException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ArcUndeclaredThrowableException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ArcUndeclaredThrowableException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
protected ArcUndeclaredThrowableException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user