use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method handleMethodArgumentNotValidException.
/**
* 400 - Bad Request
*/
@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MethodArgumentNotValidException.class)
public AjaxJson handleMethodArgumentNotValidException(final MethodArgumentNotValidException e) {
AjaxJson result = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error("MethodArgumentNotValidException", e);
}
result.setSuccess(false);
result.setMsg(e.getMessage());
result.setResultCode(400);
return result;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method nullPointerExceptionHandler.
/**
* @方法:空指针异常
* @创建人:独泪了无痕
* @param ex
*/
@ResponseBody
@ExceptionHandler(NullPointerException.class)
public AjaxJson nullPointerExceptionHandler(NullPointerException ex) {
AjaxJson ajaxJson = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error("空指针异常:", ex);
}
ajaxJson.setSuccess(false);
ajaxJson.setResultCode(500);
ajaxJson.setMsg(NullPointerException.class.getName());
return ajaxJson;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method httpMessageNotWritableException.
/**
* 500 - Internal Server Error
*/
@ResponseBody
@ExceptionHandler(HttpMessageNotWritableException.class)
public AjaxJson httpMessageNotWritableException(HttpMessageNotWritableException e) {
AjaxJson result = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), e);
}
result.setSuccess(false);
result.setMsg(e.getMessage());
result.setResultCode(500);
return result;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method handleBindException.
/**
* 400 - Bad Request
*/
@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(BindException.class)
public AjaxJson handleBindException(final BindException e) {
AjaxJson result = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error("BindException", e);
}
result.setSuccess(false);
result.setMsg(e.getMessage());
result.setResultCode(400);
return result;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method conversionNotSupportedException.
/**
* 500 - Internal Server Error
*/
@ResponseBody
@ExceptionHandler(ConversionNotSupportedException.class)
public AjaxJson conversionNotSupportedException(ConversionNotSupportedException e) {
AjaxJson result = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), e);
}
result.setSuccess(false);
result.setMsg(e.getMessage());
result.setResultCode(500);
return result;
}
Aggregations