Skip to content
Snippets Groups Projects
Commit 059443b7 authored by omkar podey's avatar omkar podey Committed by Adam G-H
Browse files

Issue #3341224 by omkar.podey, Wim Leers, phenaproxima: Always catch...

Issue #3341224 by omkar.podey, Wim Leers, phenaproxima: Always catch \Throwable, not \Exception, and pass the old exception when re-throwing
parent acadff24
No related branches found
No related tags found
5 merge requests!989Issue #3356804 by phenaproxima: Flag a warning during status check if the...,!722Issue #3341224: Always catch \Throwable, not \Exception and always pass the old exception when re-throwing.,!685Issue #3338667: [PP-1] Add build test to test cweaganscomposer-patches end-to-end,!548Issue #3310729: Incorrect documentation link in UI in case of Process error,!106Issue #3247479: Allow LockFileValidator results to carry multiple messages, and improve their text
......@@ -291,8 +291,8 @@ class Stage implements LoggerAwareInterface {
try {
$ignored_paths = $this->getIgnoredPaths();
}
catch (\Exception $e) {
throw new StageException($e->getMessage());
catch (\Throwable $throwable) {
throw new StageException($throwable->getMessage(), $throwable->getCode(), $throwable);
}
$event = new PreCreateEvent($this, $ignored_paths);
// If an error occurs and we won't be able to create the stage, mark it as
......@@ -376,8 +376,8 @@ class Stage implements LoggerAwareInterface {
try {
$ignored_paths = $this->getIgnoredPaths();
}
catch (\Exception $e) {
throw new StageException($e->getMessage());
catch (\Throwable $throwable) {
throw new StageException($throwable->getMessage(), $throwable->getCode(), $throwable);
}
// If an error occurs while dispatching the events, ensure that ::destroy()
......
......@@ -36,9 +36,9 @@ trait StatusCheckTrait {
$ignored_paths = new CollectIgnoredPathsEvent($stage);
$event_dispatcher->dispatch($ignored_paths);
}
catch (\Exception $e) {
catch (\Throwable $throwable) {
// We can't dispatch the status check event without the ignored paths.
return [ValidationResult::createErrorFromThrowable($e, t("Unable to collect ignored paths, therefore can't perform status checks."))];
return [ValidationResult::createErrorFromThrowable($throwable, t("Unable to collect ignored paths, therefore can't perform status checks."))];
}
$event = new StatusCheckEvent($stage, $ignored_paths->getAll());
......
......@@ -45,8 +45,8 @@ final class ComposerSettingsValidator implements EventSubscriberInterface {
try {
$setting = (int) $this->inspector->getConfig('secure-http', $dir);
}
catch (\Exception $exception) {
$event->addErrorFromThrowable($exception, $this->t('Unable to determine Composer <code>secure-http</code> setting.'));
catch (\Throwable $throwable) {
$event->addErrorFromThrowable($throwable, $this->t('Unable to determine Composer <code>secure-http</code> setting.'));
return;
}
if ($setting !== 1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment