Back to FlowSsh Documentation

ErrorHandler Class

[C++]

class ErrorHandler : public RefCountable, public NoCopy
{
public:
  virtual void OnExceptionInHandler(bool fatal, wchar_t const* desc) = 0;
}

Members

Overrides

  • OnExceptionInHandler: Invoked if there is an uncaught exception in one of your handlers.
    Parameters:
    • fatal:
      true: The error was caught by FlowSshC's structured-exception-handling; memory leaks may have occured due to undestroyed C++ objects created on the stack of the handler. Terminate the application in response to fatal errors. In fact for some errors the core library (FlowSshC) terminates the process automatically after this event.
      false: You may just log the error and continue executing the program.
    • desc: Description of the error.

Remarks

FlowSshCpp handlers/overrides are invoked by internal FlowSshC worker threads. If an uncaught exception happens while triggering a handler or while executing one of your overrides, this exception triggers another handler, the [ErrorHandler]OnExceptionInHandler. With OnExceptionInHandler you get informed about uncaught exceptions that you would not notice otherwise. You should always register this handler through an Initializer before using any other FlowSshCpp functionality. Usually uncaught exceptions are simply logged so the flawed handler/override implementation can possibly be fixed later. For fatal errors one should also terminate the application, as memory leaks may occur due to undestroyed C++ objects created on the stack of the handler.

Important: Never throw exceptions from this override, because they cannot be handled by the application.