Skip to content

Commit

Permalink
Do not handle exception in UserAction ModalExecutor (#2008)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Feb 24, 2023
1 parent a4d004f commit 4844118
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions src/UserAction/StepExecutorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,23 @@ protected function setFormField(Form $form, array $fields, string $step): Form
protected function runSteps(): void
{
$this->loader->set(function (Loader $p) {
try {
switch ($this->step) {
case 'args':
$this->doArgs($p);
switch ($this->step) {
case 'args':
$this->doArgs($p);

break;
case 'fields':
$this->doFields($p);
break;
case 'fields':
$this->doFields($p);

break;
case 'preview':
$this->doPreview($p);
break;
case 'preview':
$this->doPreview($p);

break;
case 'final':
$this->doFinal($p);
break;
case 'final':
$this->doFinal($p);

break;
}
} catch (\Exception $e) {
$this->handleException($e, $p, $this->step);
break;
}
});
}
Expand Down Expand Up @@ -515,20 +511,4 @@ protected function getActionArgs(array $data): array

return $args;
}

protected function handleException(\Throwable $exception, View $view, string $step): void
{
$msg = Message::addTo($view, ['Error:', 'type' => 'error']);
$msg->text->addHtml($this->getApp()->renderExceptionHtml($exception));
$view->js(true, $this->nextStepBtn->js()->addClass('disabled'));
if (!$this->isFirstStep($step)) {
$this->jsSetPrevHandler($view, $step);
}
if ($this->isLastStep($step)) {
$view->js(true, $this->execActionBtn->js()->addClass('disabled'));
}
if ($step === 'final') {
$this->jsSetPrevHandler($view, $this->steps[count($this->steps) - 1]);
}
}
}

0 comments on commit 4844118

Please sign in to comment.