mirror of
https://github.com/wisemapping/wisemapping-open-source.git
synced 2025-04-17 17:15:31 +08: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();
|
||
|
}
|
||
|
}
|