Betterembed should stop throwing WSOD when get bad request response.

Created on 1 April 2024, 6 months ago
Updated 2 April 2024, 6 months ago

Problem/Motivation

Betterembed doesn't work in Drupal 10 right now. The result when using the example tweet from the text format screen is:

AH01071: Got error 'PHP message: Uncaught PHP Exception GuzzleHttp\\Exception\\ClientException: "Client error: `GET https://api.betterembed.com/api/v0/item?url=https%3A%2F%2Ftwitter.com%2F...` resulted in a `400 Bad Request` response:\n{\n "title": "Bad Request",\n "status": 400,\n "detail": "Maximum (5) redirects followed"\n}\n" at /var/www/drupal/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php line 113',

Steps to reproduce

Install Better Embed as usual
Enable Betterembed Text format Filter for at least one text format and save the format.
create a new article using the text format better embed is enabled for
add the example URL in text area/CKEditor: https://twitter.com/drupal/status/735873777683320832

that doesn't result just with the exception thrown above, but in addition, the site seems broken because you got the classical response:

An unexpected error has occurred on the website. Please try again later. An unexpected error has occurred on the website. Please try again later

Proposed resolution

Make sure to throw just an information message instead, when API/Service responds with failure, instead of showing WSOD.

Remaining tasks

debug
change code

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany Joachim Namyslo Bayreuth 🇩🇪 🇪🇺

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

Comments & Activities

Production build 0.71.5 2024