Problem

When a route explicitly requires _format: html (e.g. Views pages like /user/{id}/scheduled_media), accessing it via the CE API returns a 406 with the generic Drupal core
message:

Title: "Client error"
Content: "A client error happened"

This comes from core's Http4xxController::on4xx() fallback. It gives no indication of what went wrong.

The CE API should return a more descriptive error, e.g.:
- Title: "Not Acceptable"
- Content: "This page does not support the requested format. Supported formats: html."

This could be handled in CustomElementsHttpExceptionSubscriber by adding an on406() method or by improving the generic 4xx handling to include the exception message.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs review

  • fago committed d87e4d5d on 2.x
    fix: #3579385 Improve error message for routes that don't support...
fago’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.