Improve logging in locale_translation_download_source()

Created on 10 September 2025, 8 days ago

Problem/Motivation

When locale_translation_download_source() encounters any exception with either HTTP or the filesystem, only “Unable to download translation file …” is logged, with no detail except for the URL. In cases like 🐛 PoStreamReader::readLine() throws an error on module install Needs work , 🐛 Unable to download translations Active and reports via Slack, it is hard to provide support as there is no way to tell if it is a server issue, connectivity to the server, or a local filesystem problem.

The exceptions caught don’t have any \Drupal::messenger()->addError(…) that makes it to Drush output, so either there is another type of exception happening, or Drush just doesn’t show the messenger output.

Steps to reproduce

Proposed resolution

Logs should include:

  • The general type of exception, filesystem or HTTP, following the \Drupal::messenger() calls, assuming the exception types are good.
  • Potentially the class of the exception, in case there is an unexpected exception, or to provide more technical detail for the ones caught.
  • The exception’s ->getMessage()
  • If it was an HTTP error, the HTTP error code. Ideally any response body too.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

language system

Created by

🇺🇸United States drumm NY, US

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024