Skip to content
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

Propagate error code if between 400 and 600 for production sites #2181

Merged
merged 1 commit into from
Nov 12, 2018
Merged

Propagate error code if between 400 and 600 for production sites #2181

merged 1 commit into from
Nov 12, 2018

Conversation

Perlkonig
Copy link
Contributor

@Perlkonig Perlkonig commented Sep 12, 2018

Fix for issue #2164.

The code is only propagated if both of the following are true, otherwise the default 500 is thrown:

  • system:errors:display is 0 or -1
  • The error code is between 400 and 599

The first condition is necessary because when verbosity is 1, it uses the built-in Whoops handler. The only way to override (that I can find) is to create our own PrettyPageHandler that inherits from the built-in one and that contains the propagation code. But I wanted a minimal solution for now. I am happy to take the next step if this approach is acceptable.

I tested this by throwing a new RuntimeException in Grav\Common\Twig\Twig::processSite. I also tested throwing with no code. Certainly more tests are necessary, but I don't know enough about the possible repercussions.

Let me know if you'd like me to make further changes.

@rhukster
Copy link
Member

Merging!

@rhukster rhukster merged commit bf86b5a into getgrav:develop Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants