[HOTFIX] AOPの例外処理を修正しました。

This commit is contained in:
s-choi
2026-09-29 10:21:59 +09:00
parent f1e48b02f9
commit aad285f9ba

View File

@@ -11,6 +11,7 @@ import org.springframework.ui.Model;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.resource.NoResourceFoundException;
import com.example.demo.exception.NoSessionException;
@@ -53,16 +54,26 @@ public class GlobalExceptionHandler {
return "error";
}
@ExceptionHandler(Exception.class)
public String AllException(Model model, Exception e, HttpSession session) {
@ExceptionHandler(NoResourceFoundException.class)
public void noResourceException(Model model, Exception e, HttpSession session) {
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
e.printStackTrace();
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
System.out.println("session invalidated");
session.invalidate();
}
@ExceptionHandler(Exception.class)
public String AllException(Model model, Exception e, HttpSession session) {
e.printStackTrace();
System.out.println(" .well-known/appspecific/com.chrome.devtools.json for request error");
return "error";
}