Skip to content

Commit ff956ae

Browse files
pprkutSMillerDev
authored andcommitted
Revert "Requests: Combine handling of Exception and InvalidArgument in one catch"
Multi-catch is PHP 7.1+, and we still need to support 5.6 This reverts commit 11faa0f.
1 parent a931e3f commit ff956ae

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Requests.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,19 @@ 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|InvalidArgument $e) {
476+
} catch (Exception $e) {
477+
if ($e->failed_hook_handled === FALSE) {
478+
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
479+
$e->failed_hook_handled = TRUE;
480+
}
481+
482+
throw $e;
483+
} catch (InvalidArgument $e) {
477484
if ($e->failed_hook_handled === FALSE) {
478485
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
479486
$e->failed_hook_handled = TRUE;
480487
}
488+
481489
throw $e;
482490
}
483491

0 commit comments

Comments
 (0)