try { $response =
$this->formAjaxResponseBuilder->
buildResponse($request,
$form,
$form_state,
[]);
// Since this response is being set in place of an exception, explicitly
// mark this as a 200 status.
$response->
setStatusCode(200
);
$event->
allowCustomResponseCode();
$event->
setResponse($response);
} catch (\Exception
$e) { // Otherwise, replace the existing exception with the new one.
$event->
setThrowable($e);
} } } /**
* Extracts a form AJAX exception.
*
* @param \Throwable $e
* A generic exception that might contain a form AJAX exception.
*
* @return \Drupal\Core\Form\FormAjaxException|null
* Either the form AJAX exception, or NULL if none could be found.
*/