exception
parent
09c7b2d0d0
commit
7d4529be0d
@ -0,0 +1,17 @@
|
|||||||
|
package com.gszc.controller;
|
||||||
|
|
||||||
|
import com.gszc.build.Result;
|
||||||
|
import com.gszc.build.ResultBuilder;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
public class ExceptionController {
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public Result runtimeExceptionHandler(Exception e) {
|
||||||
|
return ResultBuilder.error(e.getMessage(),e).build();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue