I've written a custom finisher for EXT:form. In this finisher, I submit a request to a REST API. When this request fails, I want to show the last step of the form again with an error or flash message. Is this somehow possible or is it just possible to throw an exception (FinisherException) in the finisher?
0
votes
1 Answers
0
votes
You can use the FlashMessageFinisher
in your custom finisher and call it like follows:
$flashMessageFinisher = $this->objectManager->get(FlashMessageFinisher::class);
$flashMessageFinisher->setOptions([
'messageBody' => $errorMessage,
'messageCode' => $errorCode,
'severity' => AbstractMessage::ERROR,
]);
$flashMessageFinisher->execute($this->finisherContext);
$this->finisherContext->cancel();