-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
HttpExceptions do not set HTTP status code and ErrorHandler does not work as expected in testing enviroment #2516
Comments
i think we also should add exception http class for 500 server error, currently we dont have it. |
there is no need as any non-HTTP exception should result in code 500. |
hm, but we dont have it, why if we have 400 we dont have 500? it exists and should be used in core in error handler if needed, and this row will be eliminated. |
errorhandler should not throw an exception as it is the place where header should be set. Any other use case? |
nope, but i think we should be consistent. |
Also ErrorException should extend from the PHP base class for error exceptions according to what is beeing discussed here: php-fig/fig-standards#262 |
relates to this. |
I am currently testing an API system and noticed that HTTP exceptions display the error page just fine but always with status code 200 instead of the exception code.
Also we have several checks for
if(YII_ENV_TEST)
which make it hard to test error cases for example in an API where I want to test the json output but actually get only the message of the exception because in YII_ENV_TEST works different.ErrorHandling code is quite overcomplicated right now and could use a refactoring...
The text was updated successfully, but these errors were encountered: