sts_api_exception_handler


api応答エラー

1. ParentCustomException extends RuntimeException



2. ChildCustomException extends ParentCustomException



3. ExceptionErrorData



4. ExceptionHandler extends ResponseEntityExceptionHandler



5. throw exception

Map<String, object> data = new HashMap<>();
data.put("key1", "val1");
data.put("key2", "val2");
throw new ChildException(ChildException.NOT_FOUND_DATA, data);

6. expected result ...


response code : 400
{
	"result" : false,
    	"msg" : "NOT_FOUND_DATA",
    	"data" : {
    		"key1" : "val1",
            	"key2" : "val2"
    	}
}