FIX: added exception filter to catch unhandled errors

This commit is contained in:
Arthur Simas
2022-07-07 20:24:27 -03:00
parent 137f129e13
commit 88bc7fe625
3 changed files with 27 additions and 2 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import { RpcException } from '@nestjs/microservices';
import ErrorCodes from './errorCodes';
function enrichErrorCode(code: string) {
export function EnrichErrorCode(code: string) {
switch (code) {
case ErrorCodes.AUTH.WRONG_CREDENTIALS:
return {
@@ -138,7 +138,7 @@ export default class ErrorBuilder extends HttpException {
logger.log(code);
}
const { statusCode, message, error, code: rCode } = enrichErrorCode(code);
const { statusCode, message, error, code: rCode } = EnrichErrorCode(code);
super({ statusCode, message, error, code: rCode }, statusCode);
this.code = code;
}