UNPKG

node-web-mvc

Version:
28 lines (27 loc) 984 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const AbstractMethodAdviceInterceptor_1 = __importDefault(require("./AbstractMethodAdviceInterceptor")); class MethodAfterThrowingAdviceInterceptor extends AbstractMethodAdviceInterceptor_1.default { invokeAsyncSupport(invocation, v) { Promise.resolve(v).catch((ex) => { this.handler(invocation.getJoinPint(), ex); }); } invoke(invocation) { try { const v = invocation.proceed(); // 支持异步函数 this.invokeAsyncSupport(invocation, v); return v; } catch (ex) { // 如果非异步异常 this.handler(invocation.getJoinPint(), ex); throw ex; } } } exports.default = MethodAfterThrowingAdviceInterceptor;