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
No related merge requests found
...@@ -291,8 +291,8 @@ class Stage implements LoggerAwareInterface { ...@@ -291,8 +291,8 @@ class Stage implements LoggerAwareInterface {
try { try {
$ignored_paths = $this->getIgnoredPaths(); $ignored_paths = $this->getIgnoredPaths();
} }
catch (\Exception $e) { catch (\Throwable $throwable) {
throw new StageException($e->getMessage()); throw new StageException($throwable->getMessage(), $throwable->getCode(), $throwable);
} }
$event = new PreCreateEvent($this, $ignored_paths); $event = new PreCreateEvent($this, $ignored_paths);
// If an error occurs and we won't be able to create the stage, mark it as // 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 { ...@@ -376,8 +376,8 @@ class Stage implements LoggerAwareInterface {
try { try {
$ignored_paths = $this->getIgnoredPaths(); $ignored_paths = $this->getIgnoredPaths();
} }
catch (\Exception $e) { catch (\Throwable $throwable) {
throw new StageException($e->getMessage()); throw new StageException($throwable->getMessage(), $throwable->getCode(), $throwable);
} }
// If an error occurs while dispatching the events, ensure that ::destroy() // If an error occurs while dispatching the events, ensure that ::destroy()
......
...@@ -36,9 +36,9 @@ trait StatusCheckTrait { ...@@ -36,9 +36,9 @@ trait StatusCheckTrait {
$ignored_paths = new CollectIgnoredPathsEvent($stage); $ignored_paths = new CollectIgnoredPathsEvent($stage);
$event_dispatcher->dispatch($ignored_paths); $event_dispatcher->dispatch($ignored_paths);
} }
catch (\Exception $e) { catch (\Throwable $throwable) {
// We can't dispatch the status check event without the ignored paths. // 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()); $event = new StatusCheckEvent($stage, $ignored_paths->getAll());
......
...@@ -45,8 +45,8 @@ final class ComposerSettingsValidator implements EventSubscriberInterface { ...@@ -45,8 +45,8 @@ final class ComposerSettingsValidator implements EventSubscriberInterface {
try { try {
$setting = (int) $this->inspector->getConfig('secure-http', $dir); $setting = (int) $this->inspector->getConfig('secure-http', $dir);
} }
catch (\Exception $exception) { catch (\Throwable $throwable) {
$event->addErrorFromThrowable($exception, $this->t('Unable to determine Composer <code>secure-http</code> setting.')); $event->addErrorFromThrowable($throwable, $this->t('Unable to determine Composer <code>secure-http</code> setting.'));
return; return;
} }
if ($setting !== 1) { 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