@nestjs/core
Version:
The core of NestJS, a TypeScript framework for Node.js backends: modules, dependency injection and the request pipeline, on Express, Fastify or node:http.
16 lines (15 loc) • 502 B
JavaScript
import { ExecutionContextHost } from '../helpers/execution-context-host.js';
export class ExternalErrorProxy {
createProxy(targetCallback, exceptionsHandler, type) {
return async (...args) => {
try {
return await targetCallback(...args);
}
catch (e) {
const host = new ExecutionContextHost(args);
host.setType(type);
return exceptionsHandler.next(e, host);
}
};
}
}