summer-java-template-service/src/main/java/com/github/jifengnan/template/service/TemplateServiceExceptionHandler.java
@ResponseBody
    @ExceptionHandler({TopLevelBizException.class,
            HttpMessageConversionException.class,
            ServletException.class,
            TypeMismatchException.class,
            MethodArgumentNotValidException.class,
            BindException.class,
            IllegalArgumentException.class}
    )
    public TemplateHttpResult handleBizException(Exception e, HttpServletRequest request) {
        log.info(e.getMessage(), e);
        HttpStatus status = EXCEPTION_CODE_MAPPING.get(e.getClass());
        if (status == null) {
            status = HttpStatus.BAD_REQUEST;
        }
        return TemplateHttpResult.createForFailure(status.value(), e.getMessage(), request.getServletPath());
    }
/**
     * Handle the exceptions which can be processed by the users.<p/>
     * <p>
     * For example:<br/>
     * Case 1, users forgot to enter a required parameter.<br/>
     * Case 2, the balance is not enough.
     *
     * @param e       the exception
     * @param request current HTTP request
     * @return a standard HTTP result
     */
Handle the exceptions which can be processed by the users.

For example:
Case 1, users forgot to enter a required parameter.
Case 2, the balance is not enough.

@param e       the exception
@param request current HTTP request
@return a standard HTTP result
Handle the exceptions which can be processed by the users . For example : Case 1 users forgot to enter a required parameter . Case 2 the balance is not enough . @param e the exception @param request current HTTP request @return a standard HTTP result
@ResponseBody
    @ExceptionHandler({TopLevelBizException.class,
            HttpMessageConversionException.class,
            ServletException.class,
            TypeMismatchException.class,
            MethodArgumentNotValidException.class,
            BindException.class,
            IllegalArgumentException.class}
    )
    public TemplateHttpResult handleBizException(Exception e, HttpServletRequest request) {
        log.info(e.getMessage(), e);
        HttpStatus status = EXCEPTION_CODE_MAPPING.get(e.getClass());
        if (status == null) {
            status = HttpStatus.BAD_REQUEST;
        }
        return TemplateHttpResult.createForFailure(status.value(), e.getMessage(), request.getServletPath());
    }
@ ResponseBody @ ExceptionHandler ( { TopLevelBizException . class , HttpMessageConversionException . class , ServletException . class , TypeMismatchException . class , MethodArgumentNotValidException . class , BindException . class , IllegalArgumentException . class } ) public TemplateHttpResult handleBizException ( Exception e , HttpServletRequest request ) { log . info ( e . getMessage ( ) , e ) ; HttpStatus status = EXCEPTION_CODE_MAPPING . get ( e . getClass ( ) ) ; if ( status == null ) { status = HttpStatus . BAD_REQUEST ; } return TemplateHttpResult . createForFailure ( status . value ( ) , e . getMessage ( ) , request . getServletPath ( ) ) ; }
Handle the exceptions which can be processed by the users.<p/>
 <p>
 For example:<br/>
 Case 1, users forgot to enter a required parameter.<br/>
 Case 2, the balance is not enough.
Handle the exceptions which can be processed by the users . <p / > <p > For example : <br / > Case 1 users forgot to enter a required parameter . <br / > Case 2 the balance is not enough .