Revision 40236
Added by Alessia Bardi almost 9 years ago
modules/dnet-vocabulary-publisher/trunk/src/main/java/eu/dnetlib/vocabularies/publisher/controller/VocabularyExceptionController.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.vocabularies.publisher.controller; |
2 | 2 |
|
3 |
import eu.dnetlib.vocabularies.publisher.VocabularyNotFoundException; |
|
3 | 4 |
import org.springframework.http.HttpStatus; |
4 | 5 |
import org.springframework.web.bind.annotation.ControllerAdvice; |
5 | 6 |
import org.springframework.web.bind.annotation.ExceptionHandler; |
6 | 7 |
import org.springframework.web.bind.annotation.ResponseStatus; |
7 | 8 |
import org.springframework.web.servlet.ModelAndView; |
8 | 9 |
|
9 |
import eu.dnetlib.vocabularies.publisher.VocabularyNotFoundException; |
|
10 |
|
|
11 | 10 |
@ControllerAdvice |
12 | 11 |
public class VocabularyExceptionController { |
13 | 12 |
|
14 |
@ResponseStatus(HttpStatus.NOT_FOUND)
|
|
15 |
@ExceptionHandler(VocabularyNotFoundException.class)
|
|
16 |
public ModelAndView exception(final VocabularyNotFoundException e) {
|
|
13 |
@ResponseStatus(HttpStatus.NOT_FOUND)
|
|
14 |
@ExceptionHandler(VocabularyNotFoundException.class)
|
|
15 |
public ModelAndView exception(final VocabularyNotFoundException e) {
|
|
17 | 16 |
|
18 |
ModelAndView mav = new ModelAndView("error");
|
|
19 |
mav.addObject("message", e.getMessage());
|
|
20 |
return mav;
|
|
21 |
}
|
|
17 |
ModelAndView mav = new ModelAndView("error");
|
|
18 |
mav.addObject("message", e.getMessage());
|
|
19 |
return mav;
|
|
20 |
}
|
|
22 | 21 |
} |
Also available in: Unified diff
code formatting and ignores