Search in sources :

Example 1 with ExceptionEventHandler

use of com.apifest.oauth20.api.ExceptionEventHandler in project xian by happyyangyuan.

the class OAuth20Handler method invokeExceptionHandler.

@DocOAuth20Sub(name = "invokeExceptionHandler", dec = "触发异常事件监听器的回调方法", method = "", url = "", args = { @DocOAuth20SubIn(name = "req", dec = "HTTP请求封装对象", require = true, type = FullHttpRequest.class) })
private void invokeExceptionHandler(Exception ex, FullHttpRequest request) {
    List<Class<? extends ExceptionEventHandler>> handlers = LifecycleEventHandlers.exceptionHandlers;
    for (int i = 0; i < handlers.size(); i++) {
        try {
            ExceptionEventHandler handler = handlers.get(i).newInstance();
            handler.handleException(ex, request);
        } catch (InstantiationException e) {
            throw new RuntimeException("cannot instantiate exception handler", e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("cannot invoke exception handler", e);
        }
    }
}
Also used : ExceptionEventHandler(com.apifest.oauth20.api.ExceptionEventHandler) DocOAuth20Sub(info.xiancloud.core.apidoc.annotation.DocOAuth20Sub)

Aggregations

ExceptionEventHandler (com.apifest.oauth20.api.ExceptionEventHandler)1 DocOAuth20Sub (info.xiancloud.core.apidoc.annotation.DocOAuth20Sub)1