Skip to content

Commit

Permalink
Implement robust handling of forwarding of exception codes (#42393)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell authored May 16, 2022
1 parent d2429ab commit 87d1da4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Scheduling/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ protected function getDispatcher()
} catch (BindingResolutionException $e) {
throw new RuntimeException(
'Unable to resolve the dispatcher from the service container. Please bind it or install the illuminate/bus package.',
$e->getCode(), $e
is_int($e->getCode()) ? $e->getCode() : 0, $e
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ public function get(string $id)
throw $e;
}

throw new EntryNotFoundException($id, $e->getCode(), $e);
throw new EntryNotFoundException($id, is_int($e->getCode()) ? $e->getCode() : 0, $e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Concerns/ManagesTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function handleTransactionException(Throwable $e, $currentAttempt, $ma
$this->getName(), $this->transactions
);

throw new DeadlockException($e->getMessage(), (int) $e->getCode(), $e);
throw new DeadlockException($e->getMessage(), is_int($e->getCode()) ? $e->getCode() : 0, $e);
}

// If there was an exception we will rollback this transaction and then we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function render($request, Throwable $e)

if ($e instanceof NotFoundHttpException) {
throw new NotFoundHttpException(
"{$request->method()} {$request->url()}", $e, $e->getCode()
"{$request->method()} {$request->url()}", $e, is_int($e->getCode()) ? $e->getCode() : 0
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Mail/Transport/SesTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function doSend(SentMessage $message): void
)
);
} catch (AwsException $e) {
throw new Exception('Request to AWS SES API failed.', $e->getCode(), $e);
throw new Exception('Request to AWS SES API failed.', is_int($e->getCode()) ? $e->getCode() : 0, $e);
}

$messageId = $result->get('MessageId');
Expand Down

0 comments on commit 87d1da4

Please sign in to comment.