From 11faa0f93fd0da3b81e2818adf84e6062dfe9923 Mon Sep 17 00:00:00 2001 From: Heinz Wiesinger Date: Mon, 14 Mar 2022 09:49:04 +0100 Subject: [PATCH] Requests: Combine handling of Exception and InvalidArgument in one catch --- src/Requests.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; }