$exceptionHandlerProvider

Configuration provider for $exceptionHandler service.

Description

Instance of ng.ExceptionHandlerProvider for configuring the $exceptionHandler service.

The default implementation returns ng.ExceptionHandler function, which simply rethrows the exception.

NOTE: custom implementations should always rethrow the error as the framework assumes that $exceptionHandler always does the throwing.

Properties


$exceptionHandler.handler

Customize the exceptionHandler function.

  • Type: ng.ExceptionHandler
  • Default: Function that rethrows the exception.
  • Example:
    angular.module('demo', [])
      .config([
        "$exceptionHandlerProvider",
        /** @param {ng.ExceptionHandlerProvider} $exceptionHandlerProvider */
        ($exceptionHandlerProvider) => {
          exceptionHandlerProvider.handler = (error) => {
            myLogger.capture(error);
            // Rethrow to preserve fail-fast behavior:
            throw error;
          };
        }
      ]);
    

For service description, see $exceptionHandler.


Last modified December 15, 2025: Fix types (9dd2257)