Skip to content

Commit 11faa0f

Browse files
committed
Requests: Combine handling of Exception and InvalidArgument in one catch
1 parent e35fa45 commit 11faa0f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Requests.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,8 @@ public static function request($url, $headers = [], $data = [], $type = self::GE
473473
$options['hooks']->dispatch('requests.before_parse', [&$response, $url, $headers, $data, $type, $options]);
474474

475475
$parsed_response = self::parse_response($response, $url, $headers, $data, $options);
476-
} catch (Exception $e) {
477-
$options['hooks']->dispatch('requests.failed', [$e, $url, $headers, $data, $type, $options]);
478-
throw $e;
479-
} catch (InvalidArgument $e) {
480-
$options['hooks']->dispatch('requests.failed', [$e, $url, $headers, $data, $type, $options]);
476+
} catch (Exception|InvalidArgument $e) {
477+
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
481478
throw $e;
482479
}
483480

0 commit comments

Comments
 (0)