-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throwing arbitrary error codes #2164
Comments
FYI: This is something that is limited by Whoops -- it will always use 500 errors in its responses. Overriding error handlers (especially for JSON) may be helpful, but requires some core changes. |
Well this gives me a place to look, at least. So does this mean that existing calls like this and this in Grav core aren't actually working either? |
Some of the exceptions are catched by Grav or plugins so they work. |
PR submitted. |
From within the Grav core code, I want to be able to emit an arbitrary HTTP status code. I'm told I should be able to do something like
throw new \RuntimeException("Should be a 406", 406);
, but that doesn't actually work.I want to make changes to
Grav\Common\Twig\Twig.php
, specifically theprocessSite
function. So I try the following:What I get is an error page with a
status
header of500
. I've tried tracing back where the status code gets set, but I can't find it. I would appreciate any assistance in understanding the lifecycle here. The earliest I can find is the end ofindex.php
. But I can't find any code that triggersonFatalException
.The text was updated successfully, but these errors were encountered: