onError abstract method

void onError(
  1. void onError(
    1. HttpConnect? connect,
    2. dynamic error,
    3. StackTrace? stackTrace
    )?
)

The application-specific error handler to listen all uncaught errors

  • that ever happen in this server.
  • If the connect argument is null, it means it is a server error,
  • or a uncaught error happening in an asynchronous operation.
  • If not null, it means it is caused by an event handler or an event filter.
  • Notice: all uncaught error will be handled automatically, such as
  • closing up the connection, if any, and log the error message,
  • Thus, you rarely need to register an error handler.
  • Once onError is assigned, the default logging will be disabled,
  • i.e., it is onError's job to log it.

Implementation

void onError(void onError(HttpConnect? connect, error, StackTrace? stackTrace)?);