Controller/FormController.php
public function errorResponse(string $formUuid = null)
    {
        $messages = $this->messageBus->getMessagesJson();

        if ($formUuid) {
            foreach ($messages as $message) {
                $this->addFlash(
                    'warning',
                    $message['message']
                );
            }

            return $this->redirectToForm($formUuid);
        }

        return new JsonResponse($messages);
    }
public function errorResponse(string $formUuid = null)
    {
        $messages = $this->messageBus->getMessagesJson();

        if ($formUuid) {
            foreach ($messages as $message) {
                $this->addFlash(
                    'warning',
                    $message['message']
                );
            }

            return $this->redirectToForm($formUuid);
        }

        return new JsonResponse($messages);
    }
Returns info from the messageBus.

@param string|NULL $formUuid

@return JsonResponse|RedirectResponse|Response