Spaces:
Sleeping
Sleeping
File size: 1,091 Bytes
cfbbc1a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouterProxy = void 0;
const execution_context_host_1 = require("../helpers/execution-context-host");
class RouterProxy {
createProxy(targetCallback, exceptionsHandler) {
return async (req, res, next) => {
try {
await targetCallback(req, res, next);
}
catch (e) {
const host = new execution_context_host_1.ExecutionContextHost([req, res, next]);
exceptionsHandler.next(e, host);
return res;
}
};
}
createExceptionLayerProxy(targetCallback, exceptionsHandler) {
return async (err, req, res, next) => {
try {
await targetCallback(err, req, res, next);
}
catch (e) {
const host = new execution_context_host_1.ExecutionContextHost([req, res, next]);
exceptionsHandler.next(e, host);
return res;
}
};
}
}
exports.RouterProxy = RouterProxy;
|