Class SplibExceptionHandler
java.lang.Object
jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler
Provides an exception handler.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SplibGeneralController<?> Returns the controller from which the exception throws.org.springframework.web.servlet.ModelAndViewhandleAppException(jp.ecuacion.lib.core.exception.checked.AppException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesAppException.org.springframework.web.servlet.ModelAndViewhandleAppWarningException(WebAppWarningException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesAppWarningException.org.springframework.web.servlet.ModelAndViewhandleOptimisticLockingFailureException(OverlappingFileLockException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesOverlappingFileLockException.org.springframework.web.servlet.ModelAndViewhandleRedirectNeededExceptions(Exception exception, org.springframework.ui.Model newModel) Catches some specific exceptions.org.springframework.web.servlet.ModelAndViewhandleThrowable(Throwable exception, org.springframework.ui.Model model) CatchesThrowable.
-
Constructor Details
-
SplibExceptionHandler
public SplibExceptionHandler()
-
-
Method Details
-
getController
Returns the controller from which the exception throws.- Returns:
- SplibGeneralController
-
handleAppWarningException
@ExceptionHandler(jp.ecuacion.lib.core.exception.checked.AppWarningException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleAppWarningException(@Nonnull WebAppWarningException exception, @Nullable @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesAppWarningException.- Parameters:
exception- AppWarningExceptionloginUser- UserDetails, may benullwhen the user is not logged in- Returns:
- ModelAndView
- Throws:
Exception- Exception
-
handleAppException
@ExceptionHandler(jp.ecuacion.lib.core.exception.checked.AppException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleAppException(@Nonnull jp.ecuacion.lib.core.exception.checked.AppException exception, @Nullable @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesAppException.- Parameters:
exception- AppExceptionloginUser- UserDetails- Returns:
- ModelAndView
- Throws:
Exception- Exception
-
handleOptimisticLockingFailureException
@ExceptionHandler(OverlappingFileLockException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleOptimisticLockingFailureException(@Nonnull OverlappingFileLockException exception, @Nullable @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesOverlappingFileLockException.- Parameters:
exception- AppExceptionloginUser- UserDetails- Returns:
- ModelAndView
- Throws:
Exception- Exception
-
handleRedirectNeededExceptions
@ExceptionHandler({org.springframework.web.servlet.resource.NoResourceFoundException.class,RedirectException.class}) @Nonnull public org.springframework.web.servlet.ModelAndView handleRedirectNeededExceptions(@RequireNonnull Exception exception, org.springframework.ui.Model newModel) Catches some specific exceptions.- NoResourceFoundException: No @RequestMapping settings in controllers which matches the request url.
- RedirectException: @RequestMapping settings exists, but html file does not exist.
- Parameters:
exception- ExceptionnewModel- When Exception occurs before Controller#prepare called, getModel() is null. In that case, this new model can be used. This is different from the one you get at controller.- Returns:
- ModelAndView
-
handleThrowable
-