Search in sources :

Example 1 with ExceptionJSONInfo

use of com.hry.spring.mvc.exceptionhandling.support.ExceptionJSONInfo in project spring_boot by hryou0922.

the class GlobalExceptionHandler method handleEmployeeNotFoundException.

@ExceptionHandler(EmployeeExJsonException.class)
@ResponseBody
public ExceptionJSONInfo handleEmployeeNotFoundException(HttpServletRequest request, Exception ex) {
    ExceptionJSONInfo response = new ExceptionJSONInfo();
    response.setUrl(request.getRequestURL().toString());
    response.setMessage(ex.getMessage());
    return response;
}
Also used : ExceptionJSONInfo(com.hry.spring.mvc.exceptionhandling.support.ExceptionJSONInfo) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ExceptionJSONInfo (com.hry.spring.mvc.exceptionhandling.support.ExceptionJSONInfo)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1