ExceptionHandler class

Provides a hook for centralized exception handling.

The default implementation of ExceptionHandler when use AngularDart is actually BrowserExceptionHandler, which prints error message directly to the console.

It's possible to instead write a custom exception handler:

import 'package:angular/angular.dart';

class MyExceptionHandler implements ExceptionHandler {
  void call(exception, [stackTrace, String reason]) {
    // Do something with this exception, like send to an online service.

void main() {
  bootstrap(MyApp, [
    provide(ExceptionHandler, useClass: MyExceptionHandler),


ExceptionHandler(Logger _logger)


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


call(dynamic exception, [dynamic stackTrace, String reason]) → void
Handles an exception caught at runtime. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]

Static Methods

debugAsyncStackTraces([bool enabled = true]) → void
In debug/development mode, log "long" (asynchronous) stack traces. [...]
exceptionToString(dynamic exception, [dynamic stackTrace, String reason]) String
Internal use only: Converts a caught angular exception into a string.