Skip to content

Commit 92bc1f5

Browse files
committed
fix: "Update Catch decorator to handle non-string category values"
1 parent 6ad9723 commit 92bc1f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/decorators/Catch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export function Catch(customResponse?: ErrorResponse) {
2121
statusCode: error.statusCode || 500,
2222
category: 'General',
2323
};
24-
logger.error(`[Category: ${errorResponse.category}] : ${error.message}`);
24+
const category = typeof errorResponse.category === 'string' ? errorResponse.category : 'General';
25+
logger.error(`[Category: ${category}] : ${error.message}`);
2526
}
2627
});
2728
}

0 commit comments

Comments
 (0)