Class SplibExceptionHandler

java.lang.Object
jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler

public abstract class SplibExceptionHandler extends Object
Provides an exception handler.
  • Constructor Details

    • SplibExceptionHandler

      public SplibExceptionHandler()
  • Method Details

    • getController

      @Nonnull protected SplibGeneralController<?> 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
      Catches AppWarningException.
      Parameters:
      exception - AppWarningException
      loginUser - UserDetails, may be null when 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
      Catches AppException.
      Parameters:
      exception - AppException
      loginUser - 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
      Catches OverlappingFileLockException.
      Parameters:
      exception - AppException
      loginUser - 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 - Exception
      newModel - 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

      @ExceptionHandler(Throwable.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleThrowable(@Nonnull Throwable exception, @Nonnull org.springframework.ui.Model model)
      Catches Throwable.
      Parameters:
      exception - Throwable
      model - model
      Returns:
      ModelAndView