@opra/nestjs
Version:
Opra NestJS module
20 lines (19 loc) • 927 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("@nestjs/common");
const external_exception_filter_js_1 = require("@nestjs/core/exceptions/external-exception-filter.js");
const common_2 = require("@opra/common");
const { RpcControllerDecoratorFactory } = common_2.classes;
const oldCatchMethod = external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch;
external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch = function (exception, host) {
const opraContext = host.getArgByIndex(3);
// Prevents error logging for all Opra controllers
if (opraContext && opraContext.request && opraContext.response)
throw exception;
oldCatchMethod(exception, host);
};
RpcControllerDecoratorFactory.augment((decorator, decoratorChain) => {
decoratorChain.push((_, target) => {
(0, common_1.Controller)()(target);
});
});