added logs in masterdataserviceimpl
This commit is contained in:
@@ -39,4 +39,23 @@ public class GlobalExceptionHandler {
|
||||
|
||||
return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ NEW: Handle ALL other exceptions (Generic Handler)
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<ResponseModel<?>> handleAllExceptions(Exception ex) {
|
||||
|
||||
// ✅ Internal logging (tumhare system ko pata chale)
|
||||
System.err.println("INTERNAL SERVER ERROR: " + ex.getMessage());
|
||||
ex.printStackTrace(); // Stack trace for debugging
|
||||
|
||||
// ✅ Client ko generic message
|
||||
ResponseModel<?> response = new ResponseModel<>(
|
||||
"Service temporarily unavailable. Please try again later.",
|
||||
"FAILED",
|
||||
HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||
null
|
||||
);
|
||||
|
||||
return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user