Problem/Motivation

When there's a problem with the site, it simply prints

The website encountered an unexpected error. Try again later.

.

However, HTTP error code 200 is still being returned, which means everything is okay.

This is problematic because:

  • it's incorrect, and
  • monitoring services rely on non-200 error codes to issue alerts so admins won't know that there's a problem.

Steps to reproduce

Set your DB to read-only, and hit a page in Drupal that needs to write to it.

Proposed resolution

Return a more logical error code, like 500 (but suggestions welcome).

Remaining tasks

TBD

User interface changes

None.

Introduced terminology

None.

API changes

Maybe. Depends on whether anything depends on these returning 200 when they shouldn't.

Data model changes

Hopefully none.

Release notes snippet

TBD

Comments

colan created an issue. See original summary.

danielveza’s picture

I can only see two references to The website encountered an unexpected error. Try again later. in cores codebase. FinalExceptionSubscriber & errors.inc. Both places set the status code to 500 and there is test coverage for this.

Could there be a contrib module or custom code that is interferring here?

I tested this by throwing exceptions in the code, and introducing syntax errors. Both returned 500s in the browser

cilefen’s picture

colan’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Works for me! I couldn't find anything like that earlier. Thanks y'all for looking into it.

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

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

Maintainers, please credit people who helped resolve this issue.