Thursday, June 5, 2014

Catching low-level controller exceptions in Jackson

This is useful code, that could be used in controllers to catch exception while parsing json data by jackson.

    @ExceptionHandler({org.springframework.http.converter.HttpMessageNotReadableException.class})
    @ResponseBody
    public String resolveException(Exception e) throws Exception{
        throw e;
    }

It catches all exception thrown by this class members.

No comments:

Post a Comment