public static function safePromise(PromiseInterface $promise)
    {
        return $promise->then(null, function ($value) {
            if (TypeUtils::isFatalThrowable($value)) {
                throw $value;
            }
            return $value;
        });
    }