|
|
@ -0,0 +1,17 @@ |
|
|
|
package com.iflytop.digester.underframework.controller; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.web.bind.annotation.ControllerAdvice; |
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler; |
|
|
|
@ControllerAdvice |
|
|
|
public class UfApiControllerExceptionHandler { |
|
|
|
@ExceptionHandler(RuntimeException.class) |
|
|
|
public ResponseEntity<Object> handleException(RuntimeException ex) { |
|
|
|
var response = new UfApiResponse(); |
|
|
|
response.success = false; |
|
|
|
response.code = "500"; |
|
|
|
response.message = ex.getMessage(); |
|
|
|
response.data = null; |
|
|
|
return new ResponseEntity<>(response, HttpStatus.OK); |
|
|
|
} |
|
|
|
} |