Git-Leon 7 лет назад
Родитель
Сommit
2edeb76dee
1 измененных файлов: 3 добавлений и 3 удалений
  1. 3
    3
      README.md

+ 3
- 3
README.md Просмотреть файл

@@ -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