fix: #3634860 Log a fixed text and the exception class instead of the provider's error message

Issue: https://www.drupal.org/project/ai_media/issues/3634860

Generation, name/alt and AI Context failures now log a fixed text with the exception class instead of the provider's message, which can echo the API key (OpenAI repeats a wrong key, and a masked real one). Administrators still see the redacted details on the page. Kernel test added in ErrorMessagesTest.

Before and after

Before (1.0.x): the ai_media entry in Recent log messages carries the provider's text, with the key (a fake test key here).

Before: the log message reads image generation failed: OpenAI\Exceptions\ErrorException: Incorrect API key provided: sk-wrong.

After: the entry names the operation and the exception class only.

After: the log message reads image generation failed with OpenAI\Exceptions\ErrorException.

AI-Generated: Yes

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release

🤖 Generated with Claude Code

Edited by Rajab Natshah

Merge request reports

Loading
Loading