Skip to content

Commit

Permalink
Revert "Requests: Combine handling of Exception and InvalidArgument i…
Browse files Browse the repository at this point in the history
…n one catch"

Multi-catch is PHP 7.1+, and we still need to support 5.6

This reverts commit 11faa0f.
  • Loading branch information
pprkut committed Sep 8, 2023
1 parent f06646a commit 773103c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,19 @@ 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|InvalidArgument $e) {
} catch (Exception $e) {
if ($e->failed_hook_handled === FALSE) {
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
$e->failed_hook_handled = TRUE;
}

throw $e;
} catch (InvalidArgument $e) {
if ($e->failed_hook_handled === FALSE) {
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
$e->failed_hook_handled = TRUE;
}

throw $e;
}

Expand Down

0 comments on commit 773103c

Please sign in to comment.