Better documentation & error handling for missing credentials

Created on 28 June 2025, 6 days ago

Problem/Motivation

If you have not entered the in unsplash credentials in intermediate field settings and you start adding media items then you will get this error:

The website encountered an unexpected error. Try again later.

Unsplash\Exception: ["OAuth error: The access token is invalid"] in Unsplash\Endpoint::__callStatic() (line 98 of /var/www/html/vendor/unsplash/unsplash/src/Endpoint.php).
Unsplash\Photo::find('9SL_aTkpWaI') (Line: 61)
Drupal\media_entity_unsplash\UnsplashFetcher->fetchImage('9SL_aTkpWaI') (Line: 179)
Drupal\media_entity_unsplash\Plugin\media\Source\Unsplash->fetchImageT('9SL_aTkpWaI') (Line: 194)
Drupal\media_entity_unsplash\Plugin\media\Source\Unsplash->getMetadata(Object, 'thumbnail_uri') (Line: 266)
Drupal\media\Entity\Media->getThumbnailUri() (Line: 162)
Drupal\media\Entity\Media->updateThumbnail() (Line: 449)
Drupal\media\Entity\Media->prepareSave() (Line: 27)
Drupal\media\MediaStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 293)
Drupal\Core\Entity\EntityForm->save(Array, Object) (Line: 61)
Drupal\media\MediaForm->save(Array, Object)

Documentation is not clear enough about selling credentials before doing anything.

Steps to reproduce

Enable to module. Add a media item.

Proposed resolution

Make some documentation changes suits more explicit did you need to enter the credentials? Also explain where to find the credentials.

Improve the error message.

Remaining tasks

Everything

User interface changes

Improved error message

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇳🇱Netherlands batigolix Utrecht

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