trayliang commented on code in PR #298:
URL: 
https://github.com/apache/apisix-java-plugin-runner/pull/298#discussion_r2078955570


##########
runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/ExceptionCaughtHandler.java:
##########
@@ -21,15 +21,33 @@
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import org.apache.apisix.plugin.runner.A6ErrResponse;
+import org.apache.apisix.plugin.runner.exception.ExceptionCaught;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class ExceptionCaughtHandler extends ChannelInboundHandlerAdapter {
     private final Logger logger = 
LoggerFactory.getLogger(ExceptionCaughtHandler.class);
 
+    List<ExceptionCaught> exceptionCaughtList = new 
ArrayList<ExceptionCaught>();
+
+    public ExceptionCaughtHandler() {
+
+    }
+
+    public ExceptionCaughtHandler(List<ExceptionCaught> exceptionCaughtList) {
+        this.exceptionCaughtList = exceptionCaughtList;
+    }
+
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) 
throws Exception {
         logger.error("handle request error: ", cause);
+        if (!exceptionCaughtList.isEmpty()) {
+            exceptionCaughtList.get(0).exceptionCaught(ctx, cause);

Review Comment:
   The Spi extension is loaded as a list. Currently, only the first one is 
taken, which is also a preparation for subsequent expansion of other



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to