18 lines
493 B
Java
18 lines
493 B
Java
|
|
package com.it.rattan.exception;
|
||
|
|
|
||
|
|
import com.it.rattan.rpc.RattanResponse;
|
||
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
|
|
||
|
|
@ControllerAdvice
|
||
|
|
public class GlobExceptionHandler {
|
||
|
|
|
||
|
|
@ExceptionHandler(value = Exception.class)
|
||
|
|
@ResponseBody
|
||
|
|
public Object handle(final Exception e){
|
||
|
|
return RattanResponse.fail(e.getMessage());
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|