Improve form loading error handling

Created on 24 January 2024, 11 months ago
Updated 9 September 2024, 3 months ago

Problem/Motivation

When the form can't be loaded, the message logged on drupal log misses the exception message details. Also, "Form failed to load" message is not suitable for some customers who are concerned of lead income loses.

Steps to reproduce

When a form can't be loaded. Can be simulated by adding the following code inside the "try" inside `getFormMarkup` function:

throw new \UnexpectedValueException(
  "Example exception",
  500
);

Proposed resolution

  • Also log the exception message
  • Allow users to configure a custom error message when forms can't be loaded into a new module's settings form. This message should be translatable in multilingual sites. Another option would be to change the "Form failed to load." with "Sorry, there was a problem loading the form. Please try again later."

Remaining tasks

User interface changes

New configuration form.

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇪🇸Spain rcodina Barcelona

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024