diff --git a/src/Requests.php b/src/Requests.php index 30aff05aa..eaf338ca1 100644 --- a/src/Requests.php +++ b/src/Requests.php @@ -473,11 +473,8 @@ public static function request($url, $headers = [], $data = [], $type = self::GE $options['hooks']->dispatch('requests.before_parse', [&$response, $url, $headers, $data, $type, $options]); $parsed_response = self::parse_response($response, $url, $headers, $data, $options); - } catch (Exception $e) { - $options['hooks']->dispatch('requests.failed', [$e, $url, $headers, $data, $type, $options]); - throw $e; - } catch (InvalidArgument $e) { - $options['hooks']->dispatch('requests.failed', [$e, $url, $headers, $data, $type, $options]); + } catch (Exception|InvalidArgument $e) { + $options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]); throw $e; }