jpablog : exception handling

This commit is contained in:
kim
2021-01-29 20:45:46 +09:00
parent 2830836a94
commit 853f09a930

View File

@@ -0,0 +1,15 @@
package com.example.jpablog.handler;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
@ControllerAdvice
@RestController
public class GlobalExceptionHandler {
@ExceptionHandler(value = Exception.class)
public String handleArgumentException(Exception e) {
return "<h1>" + e.getMessage() + "</h1>";
}
}