瀏覽代碼

update error messages

Daniel Bohry 8 月之前
父節點
當前提交
b00259f97a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/main/java/com/danielbohry/stocks/api/GlobalExceptionHandler.java

+ 2 - 2
src/main/java/com/danielbohry/stocks/api/GlobalExceptionHandler.java

@@ -14,12 +14,12 @@ public class GlobalExceptionHandler {
 
     @ExceptionHandler(FeignException.NotFound.class)
     public ResponseEntity<Error> handleNotFoundException(FeignException e, WebRequest request) {
-        return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new Error(e.getMessage()));
+        return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new Error("Not found"));
     }
 
     @ExceptionHandler(FeignException.TooManyRequests.class)
     public ResponseEntity<Error> handleTooManyRequestsException(FeignException e, WebRequest request) {
-        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new Error(e.getMessage()));
+        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new Error("Too many requests"));
     }
 
 }