
cn.gjing.ex.CommonExceptionHandler Maven / Gradle / Ivy
package cn.gjing.ex;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author Gjing
**/
@ControllerAdvice
@ResponseBody
public class CommonExceptionHandler {
@ExceptionHandler(ParamException.class)
public ResponseEntity paramException(ParamException e) {
e.printStackTrace();
return ResponseEntity.badRequest().body(e.getMessage());
}
@ExceptionHandler(HttpException.class)
public ResponseEntity httpException(HttpException e) {
e.printStackTrace();
return ResponseEntity.badRequest().body(e.getMessage());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy