public function addExceptionHandler($handler) {
        if ( ! $handler instanceof IExceptionHandler && ! is_callable($handler)) {
            throw new InvalidHandlerType(
                s('Exception handler must be a callable or an instance of %s.',
                    IExceptionHandler::class)
            );
        }

        if (is_callable($handler)) {
            $handler = $this->createExceptionHandler($handler);
        }

        $this->exceptionHandlers[] = $handler;
    }