Przeglądaj źródła

Update README.md

Git-Leon 7 lat temu
rodzic
commit
2edeb76dee
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3
    3
      README.md

+ 3
- 3
README.md Wyświetl plik

@@ -445,7 +445,7 @@ In this section we add custom handling for the exceptions we created before. A `
445 445
   - Use java.util's `new Date().getTime()` for the timestamp
446 446
   - Provide the detail and developer messages from the `ResourceNotFoundException`
447 447
 
448
-```
448
+```java
449 449
 @ExceptionHandler(ResourceNotFoundException.class)
450 450
 public ResponseEntity<?> handleResourceNotFoundException(ResourceNotFoundException rnfe, HttpServletRequest request) {...}
451 451
 ```
@@ -475,7 +475,7 @@ We also need a new field in the `ErrorDetail` class to hold errors. There may be
475 475
 
476 476
 - add below handler to `RestExceptionHandler`
477 477
 
478
-```
478
+```java
479 479
 @ExceptionHandler(MethodArgumentNotValidException.class)
480 480
 public ResponseEntity<?>
481 481
 handleValidationError(  MethodArgumentNotValidException manve,
@@ -489,7 +489,7 @@ In this handler we need to do the following:
489 489
 - For each field error, add it to the appropriate list in the ErrorDetail (see below)
490 490
 - Return a `ResponseEntity` containing the error detail and the appropriate HTTP status code (`400 Bad Request`)
491 491
 
492
-```
492
+```java
493 493
 List<FieldError> fieldErrors =  manve.getBindingResult().getFieldErrors();
494 494
 		for(FieldError fe : fieldErrors) {
495 495