resolve($value); }; /** * Fails the promise with the given exception. * * @param \Exception $reason */ $fail = function ($reason) { $this->fail($reason); }; try { $resolver($resolve, $fail); } catch (\Throwable $exception) { $this->fail($exception); } catch (\Exception $exception) { $this->fail($exception); } } }