mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-20 11:10:07 +02:00
28 lines
814 B
Java
28 lines
814 B
Java
|
package com.wisemapping.rest;
|
||
|
|
||
|
|
||
|
import org.springframework.http.HttpStatus;
|
||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||
|
|
||
|
public class BaseController {
|
||
|
|
||
|
@ExceptionHandler(IllegalArgumentException.class)
|
||
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||
|
@ResponseBody
|
||
|
public String handleClientErrors(Exception ex) {
|
||
|
ex.printStackTrace();
|
||
|
return ex.getMessage();
|
||
|
}
|
||
|
|
||
|
@ExceptionHandler(Exception.class)
|
||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||
|
@ResponseBody
|
||
|
public String handleServerErrors(Exception ex) {
|
||
|
ex.printStackTrace();
|
||
|
// LOGGER.error(ex.getMessage(), ex);
|
||
|
return ex.getMessage();
|
||
|
}
|
||
|
}
|