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

Support rendering Exceptions with previous Errors #2121

Merged
merged 2 commits into from
Mar 7, 2017
Merged

Support rendering Exceptions with previous Errors #2121

merged 2 commits into from
Mar 7, 2017

Conversation

akrabat
Copy link
Member

@akrabat akrabat commented Jan 8, 2017

If an Exception is thrown with an Error set as it's previous then we
need to render this correctly in the error handler. This simply requires
removing the type hint, however we can't do that for BC, so I've created
the method renderHtmlExceptionOrError which is now used.

Fixes #1943

@akrabat akrabat added the Slim 3 label Jan 8, 2017
@akrabat akrabat requested review from codeguy and silentworks January 8, 2017 11:15
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 97.871% when pulling 7ead6d4 on akrabat:render-previous-errors into fb5356a on slimphp:3.x.

If an Exception is thrown with an Error set as it's previous then we
need to render this correctly in the error handler. This simply requires
removing the type hint, however we can't do that for BC, so I've created
the method `renderHtmlExceptionOrError` which is now used.

Fixes #1943
@coveralls
Copy link

Coverage Status

Coverage increased (+0.004%) to 97.932% when pulling 4a6cae0 on akrabat:render-previous-errors into fb5356a on slimphp:3.x.

*
* @return string
*/
protected function renderHtmlExceptionOrError($exception)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could simplify this by hinting for Throwable instead - both Error and Exception implement this interface

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwable doesn't exist in PHP5, so it's better to be specific.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah of course, I had forgotten about the support requirements!

Copy link
Member

@codeguy codeguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Merging momentarily.

@codeguy codeguy merged commit 4a6cae0 into slimphp:3.x Mar 7, 2017
@akrabat akrabat added this to the 3.8.0 milestone Mar 7, 2017
@codeguy codeguy modified the milestones: 3.8.0, 4.0 Mar 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants