onException method Null safety

void onException(
  1. ExceptionHandler exceptHandler,
  2. [List<ExceptionHandler>? exceptHandlers]
)

Add exceptHandler and optionally exceptHandlers to be executed after handler in the route chain.

Implementation

void onException(ExceptionHandler exceptHandler,
    [List<ExceptionHandler>? exceptHandlers]) {
  _onException.add(exceptHandler);
  if (exceptHandlers != null) {
    _onException.addAll(exceptHandlers);
  }
}