When a view uses the HTTPStatusCode handler to set a 404 or 403, throw the appropriate exception

Created on 8 April 2018, over 6 years ago
Updated 5 February 2023, almost 2 years ago

Maybe I'm confused about the point of #1849356: Add a HTTP response code area handler and using it to set a 404 response code on an empty view. But I was sure expecting to see "Page not found", not an empty view page, with a 404 response that you'd only know if you were a crawler or looking closely at your debug console. ;)

If a view is configured to set a 404, it sure seems natural to expect that the area plugin's render() method would do this, too:

      if ($this->options['status_code'] == '404') {
        throw new NotFoundHttpException();
      }

Ditto 403 doing throw new AccessDeniedHttpException(); for you.

Am I expected to write a "BetterHTTPStatusCode" class that extends the core handler if I want the (IMHO, totally obvious) behavior?

Can we add this to the core handler? Perhaps as a config option? I'd rather not have to maintain a growing pile of tiny D8 modules that implement single views plugins to work-around various limitations in core. ;)

Thoughts?

Thanks!
-Derek

Feature request
Status

Needs work

Version

10.1

Component
Views 

Last updated about 5 hours ago

Created by

🇺🇸United States dww

Live updates comments and jobs are added and updated live.
  • Needs screenshots

    The change alters the user interface, so before and after screenshots should be added to document the UI change. Make sure to capture the relevant region only. Use a tool such as Aviary on Windows or Skitch on Mac OS X.

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.

Production build 0.71.5 2024