JAVA: Controller exception handling

With the @controlleradvice annotation, @exceptionhandler can specify the subdivision type of the exception on the specified controller

public class BaseController {

    private static final Logger logger = LoggerFactory.getLogger(BaseController.class);

     * Parameter type conversion error
     * @param exception error
     * @return error message
   public String parameterTypeException(HttpMessageConversionException exception){       
        return ResultErr("Type conversion error");

	 * Uniform exception handling
	@ExceptionHandler(value = Exception.class)
	public String handlerException(Exception e) {
	    logger.error("Data check failure : errorMessage{"+e.getMessage()+"}");
		return ResultErr(e.getCode(), e.getMessage());

Read More: