ExceptionInEventEventHandler Delegate

[C#]

public delegate void ExceptionInEventEventHandler(
  object sender,
  bool fatal,
  System.Exception e);

Parameters

  • sender: The source of the event. For fatal errors the sender is null.
  • fatal:
    false: There was an uncaught exception in one of your delegates, while it handled an event (for example in [Client]MyOnHostKey).
    true: Internal fatal error. You should terminate the application in response to fatal errors, as FlowSshNet is left in an unusable state. In fact, sometimes the FlowSshC core library terminates the process automatically after such an error.
  • e: Represents the error that occurred while executing an event.

Remarks

FlowSshNet events are invoked by internal FlowSshC worker threads. If an uncaught exception happens while triggering an event or while executing one of your delegates, this exception triggers another event, the [SshNet]OnExceptionInEvent. With [SshNet]OnExceptionInEvent you get informed about uncaught exceptions that you would not notice otherwise. One should always register to [SshNet]OnExceptionInEvent before using any other FlowSshNet functionality. Usually such uncaught exceptions are simply logged so the flawed delegate implementation can possibly be fixed later. For fatal internal errors one should also terminate the application, as FlowSshNet is left in an unusable state.

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