1 |
27655
|
alessia.ba
|
package eu.dnetlib.vocabularies.publisher.controller;
|
2 |
|
|
|
3 |
40236
|
alessia.ba
|
import eu.dnetlib.vocabularies.publisher.VocabularyNotFoundException;
|
4 |
27655
|
alessia.ba
|
import org.springframework.http.HttpStatus;
|
5 |
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
6 |
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
7 |
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
8 |
|
|
import org.springframework.web.servlet.ModelAndView;
|
9 |
|
|
|
10 |
|
|
@ControllerAdvice
|
11 |
|
|
public class VocabularyExceptionController {
|
12 |
|
|
|
13 |
40236
|
alessia.ba
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
14 |
|
|
@ExceptionHandler(VocabularyNotFoundException.class)
|
15 |
|
|
public ModelAndView exception(final VocabularyNotFoundException e) {
|
16 |
27655
|
alessia.ba
|
|
17 |
40236
|
alessia.ba
|
ModelAndView mav = new ModelAndView("error");
|
18 |
|
|
mav.addObject("message", e.getMessage());
|
19 |
|
|
return mav;
|
20 |
|
|
}
|
21 |
27655
|
alessia.ba
|
}
|