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';

@Injectable()
class MyExceptionHandler implements ExceptionHandler {
  @override
  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),
  ]);
}

Constructors

ExceptionHandler(Logger _logger)
const

Properties

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

Methods

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

Operators

operator ==(other) → bool
The equality operator. [...]
inherited

Static Methods

exceptionToString(exception, [ stackTrace, String reason ]) → String
Internal use only: Converts a caught angular exception into a string.