Last change
on this file was 77205be, checked in by gjoko kostadinov <gjokokostadinov@…>, 11 months ago |
Add entire code
|
-
Property mode
set to
100755
|
File size:
882 bytes
|
Line | |
---|
1 | package edu.gjoko.schedlr.config;
|
---|
2 |
|
---|
3 | import edu.gjoko.schedlr.exceptions.BlockingTimeException;
|
---|
4 | import org.springframework.http.HttpHeaders;
|
---|
5 | import org.springframework.http.HttpStatus;
|
---|
6 | import org.springframework.http.ResponseEntity;
|
---|
7 | import org.springframework.web.bind.annotation.ControllerAdvice;
|
---|
8 | import org.springframework.web.bind.annotation.ExceptionHandler;
|
---|
9 | import org.springframework.web.context.request.WebRequest;
|
---|
10 | import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
|
---|
11 |
|
---|
12 | @ControllerAdvice
|
---|
13 | public class ExceptionHandlerAdvice extends ResponseEntityExceptionHandler {
|
---|
14 |
|
---|
15 | @ExceptionHandler(value = BlockingTimeException.class)
|
---|
16 | protected ResponseEntity<Object> handleConflict(RuntimeException ex, WebRequest request) {
|
---|
17 | return handleExceptionInternal(ex, ex.getMessage(), new HttpHeaders(), HttpStatus.CONFLICT, request);
|
---|
18 | }
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.