This commit is contained in:
Michele Artini 2021-02-01 12:01:14 +01:00
parent 28788aba95
commit 3099a06e47
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package eu.dnetlib.common.controller;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ -8,9 +10,12 @@ import org.springframework.web.bind.annotation.ResponseStatus;
public abstract class AbstractDnetController {
private static final Logger log = LoggerFactory.getLogger(AbstractDnetController.class);
@ExceptionHandler(Exception.class)
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public @ResponseBody ErrorMessage handleException(final Exception e) {
log.error("Error processing http method", e);
return new ErrorMessage(e);
}