| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1x 1x 2x 1x 1x 1x 1x | import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context.host';
import { WsExceptionsHandler } from '../exceptions/ws-exceptions-handler';
export class WsProxy {
public create(
targetCallback: (...args) => Promise<void>,
exceptionsHandler: WsExceptionsHandler,
): (...args) => Promise<void> {
return async (...args) => {
try {
return await targetCallback(...args);
} catch (e) {
const host = new ExecutionContextHost(args);
exceptionsHandler.handle(e, host);
}
};
}
}
|