Provide more helpful error message when form is created without Stripe set up

Created on 4 August 2023, 11 months ago

Problem/Motivation

When a site builder first installs and configures the Give module, they might not have a Stripe account yet. They are still able to create a donation form. However, when clicking the "Give" button on that form, the user sees the generic,

The website encountered unexpected error. Please try again.

error message.

Steps to reproduce

  1. Enable and configure the Give module, leaving the Stripe fields empty
  2. View the default, Give-provided Donation form
  3. Click the "Give" button

The more specific error message, found in the logs, is

Error: Cannot unset string offsets in Drupal\Core\Field\WidgetBase->extractFormValues() (line 381 of /var/www/html/web/core/lib/Drupal/Core/Field/WidgetBase.php).

Proposed resolution

Display a more helpful message, such as

Your donation form could not be submitted because Stripe has not been configured. Contact your site administrator to report this problem.

Remaining tasks

  1. Recreate the issue
  2. Get maintainer agreement on resolution
  3. Implement resolution
  4. Test
  5. Ship!

User interface changes

None

API changes

None

Data model changes

None

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cedewey Denver, CO

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

Comments & Activities

Production build 0.69.0 2024