public static function notify($error)
    {
        // No type declaration, because of PHP 5 + PHP 7 support.
        if (!$error instanceof \Exception && !$error instanceof \Throwable) {
            // We have this error handler specifically so we never throw from Promise::when(), so it doesn't make sense
            // to throw here. We just forward a generic exception to the registered handlers.
            $error = new \Exception(\sprintf(
                "Promise implementation called %s() with an invalid argument of type '%s'",
                __METHOD__,
                \is_object($error) ? \get_class($error) : \gettype($error)
            ));
        }

        if (self::$callback === null) {
            self::triggerErrorHandler(
                "An exception has been thrown from an AsyncInterop\\Promise::when() handler, but no handler has been"
                . " registered via AsyncInterop\\Promise\\ErrorHandler::set(). A handler has to be registered to"
                . " prevent exceptions from going unnoticed. Do NOT install an empty handler that just does nothing."
                . " If the handler is called, there is ALWAYS something wrong.",
                $error
            );

            return;
        }

        try {
            \call_user_func(self::$callback, $error);
        } catch (\Exception $e) {
            self::triggerErrorHandler(
                "An exception has been thrown from the promise error handler registered to"
                . " AsyncInterop\\Promise\\ErrorHandler::set().",
                $e
            );
        } catch (\Throwable $e) {
            self::triggerErrorHandler(
                "An exception has been thrown from the promise error handler registered to"
                . " AsyncInterop\\Promise\\ErrorHandler::set().",
                $e
            );
        }
    }