naga-audit-service
Version:
A comprehensive audit service library for NestJS applications with MongoDB support
14 lines • 557 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatErrorResponse = void 0;
const common_1 = require("@nestjs/common");
const formatErrorResponse = (error, statusCode) => {
if (error.code === 11000) {
throw new common_1.HttpException({ message: 'Duplicate key error' }, common_1.HttpStatus.CONFLICT);
}
else {
throw new common_1.HttpException({ message: error.message }, statusCode);
}
};
exports.formatErrorResponse = formatErrorResponse;
//# sourceMappingURL=response-formatter.js.map