jpablog : exception handling
This commit is contained in:
@@ -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>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user