Class FailedUIRequestException

All Implemented Interfaces:
Serializable

public final class FailedUIRequestException extends RuntimeException
Carries the exception that made a SynchronizedRequestHandler fail together with the UI that was current when it failed.

The handler restores the current instances when it unlocks the session, so the UI is no longer current when the exception reaches the error handling in VaadinService. The error handling unwraps the exception and makes the UI current again while it holds the session lock. Other code that calls SynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse) directly can catch this exception and handle the original exception from getCause().

See Also:
  • Constructor Details

    • FailedUIRequestException

      public FailedUIRequestException(Exception failure, UI ui)
      Creates a new exception for the given failure and UI.
      Parameters:
      failure - the exception that made the request handler fail, not null
      ui - the UI that was current when the request handler failed, not null
  • Method Details

    • getCause

      public Exception getCause()
      Gets the exception that made the request handler fail.
      Overrides:
      getCause in class Throwable
      Returns:
      the exception, not null
    • getUI

      public UI getUI()
      Gets the UI that was current when the request handler failed.

      The session of the UI is not locked when this exception is thrown, so lock it, for example with UI.access(com.vaadin.flow.server.Command), before using the UI.

      Returns:
      the UI, or null if this exception has been deserialized