Skip to content

Commit

Permalink
Added exception handling for Exception.class
Browse files Browse the repository at this point in the history
  • Loading branch information
vikhyat187 committed Dec 25, 2023
1 parent 07ed4ef commit beec3f0
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ public ResponseEntity<GenericResponse<Object>> handleEntityAlreadyExistsExceptio
}

@ExceptionHandler({RuntimeException.class})
public ResponseEntity<GenericResponse<Object>> handleRuntimException(RuntimeException ex){
public ResponseEntity<GenericResponse<Object>> 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<GenericResponse<Object>> 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" ));
}
}

0 comments on commit beec3f0

Please sign in to comment.