简体   繁体   English

TYPO3 EXT:表单自定义装订器:错误处理

[英]TYPO3 EXT:form custom finisher: Error handling

I've written a custom finisher for EXT:form.我已经为 EXT:form 编写了一个自定义完成器。 In this finisher, I submit a request to a REST API.在此完成程序中,我向 REST API 提交请求。 When this request fails, I want to show the last step of the form again with an error or flash message.当此请求失败时,我想再次显示表单的最后一步,并显示错误或 flash 消息。 Is this somehow possible or is it just possible to throw an exception (FinisherException) in the finisher?这是否可能,或者只是有可能在整理器中引发异常(FinisherException)?

You can use the FlashMessageFinisher in your custom finisher and call it like follows:您可以在自定义完成器中使用FlashMessageFinisher并按如下方式调用它:

$flashMessageFinisher = $this->objectManager->get(FlashMessageFinisher::class);
$flashMessageFinisher->setOptions([
  'messageBody' => $errorMessage, 
  'messageCode' => $errorCode, 
  'severity' => AbstractMessage::ERROR,
]);
$flashMessageFinisher->execute($this->finisherContext);
$this->finisherContext->cancel();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM