@squareboat/nest-eyewitness
Version:
A simple easy-to-use package to receive error reports directly to your inbox whenever any exception is witnessed 👀 in your NestJS application.
25 lines (24 loc) • 784 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Eyewitness = void 0;
const service_1 = require("./service");
class Eyewitness {
static doNotReport(exceptions) {
const exceptionNames = [];
exceptions.forEach((e) => {
exceptionNames.push(e.name);
});
Eyewitness.doNotReportExceptions = exceptionNames;
}
static watch(exception, host) {
if (Eyewitness.doNotReportExceptions.includes(exception.constructor.name)) {
return;
}
const ctx = host.switchToHttp();
const request = ctx.getRequest();
service_1.EyewitnessService.alert(exception, host);
return {};
}
}
exports.Eyewitness = Eyewitness;
Eyewitness.doNotReportExceptions = [];