From beec3f0160ce597e99f43b915b257498754e9be5 Mon Sep 17 00:00:00 2001 From: vikhyat187 Date: Mon, 25 Dec 2023 20:52:27 +0530 Subject: [PATCH] Added exception handling for Exception.class --- .../com/RDS/skilltree/utils/GlobalExceptionHandler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/skill-tree/src/main/java/com/RDS/skilltree/utils/GlobalExceptionHandler.java b/skill-tree/src/main/java/com/RDS/skilltree/utils/GlobalExceptionHandler.java index 62e47d3d..2c6b464f 100644 --- a/skill-tree/src/main/java/com/RDS/skilltree/utils/GlobalExceptionHandler.java +++ b/skill-tree/src/main/java/com/RDS/skilltree/utils/GlobalExceptionHandler.java @@ -29,11 +29,18 @@ public ResponseEntity> handleEntityAlreadyExistsExceptio } @ExceptionHandler({RuntimeException.class}) - public ResponseEntity> handleRuntimException(RuntimeException ex){ + public ResponseEntity> handleRuntimeException(RuntimeException ex){ log.error("Runtime Exception - Error : {}", ex.getMessage(), ex); return ResponseEntity .status(HttpStatus.INTERNAL_SERVER_ERROR) .body(new GenericResponse<>(null, "Something went wrong, please try communicating on `#wg-skill-tree discord` channel" )); } + @ExceptionHandler({Exception.class}) + public ResponseEntity> handleException(Exception ex){ + log.error("Exception - Error : {}", ex.getMessage(), ex); + return ResponseEntity + .status(HttpStatus.INTERNAL_SERVER_ERROR) + .body(new GenericResponse<>(null, "Something went wrong, please try communicating on `#wg-skill-tree discord` channel" )); + } }