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

Provide better panic handling #5902

Merged
merged 2 commits into from
Jan 30, 2019

Conversation

zeripath
Copy link
Contributor

This PR gitea'ises the macaron.Recovery() handler meaning that in
the event of panic we get proper gitea 500 pages and the stacktrace
is logged with the Gitea logger.

It's also noted that our 500 page was not being served with the correct http status - they were currently being served with a status code of 404.

Signed-off-by: Andrew Thornton art27@cantab.net

This PR gitea'ises the macaron.Recovery() handler meaning that in
the event of panic we get proper gitea 500 pages and the stacktrace
is logged with the gitea logger.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@codecov-io
Copy link

codecov-io commented Jan 30, 2019

Codecov Report

Merging #5902 into master will decrease coverage by 0.03%.
The diff coverage is 12.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5902      +/-   ##
==========================================
- Coverage   38.01%   37.98%   -0.04%     
==========================================
  Files         328      329       +1     
  Lines       48343    48400      +57     
==========================================
+ Hits        18377    18384       +7     
- Misses      27326    27375      +49     
- Partials     2640     2641       +1
Impacted Files Coverage Δ
modules/context/context.go 49.4% <0%> (ø) ⬆️
routers/routes/routes.go 85.12% <100%> (+0.06%) ⬆️
modules/context/panic.go 7.4% <7.4%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f295ab...7548b7d. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 30, 2019
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 30, 2019
@techknowlogick techknowlogick added type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality. labels Jan 30, 2019
@techknowlogick techknowlogick added this to the 1.8.0 milestone Jan 30, 2019
@zeripath
Copy link
Contributor Author

The main gotcha with this PR is that the logs are no longer just stdout'd like the macaron logs. However, we shouldn't really be stdout'ing the macaron logs either - well unless we mean to, see #5667.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 30, 2019
@techknowlogick techknowlogick merged commit ca00ca8 into go-gitea:master Jan 30, 2019
@zeripath zeripath deleted the better-panic-handling branch April 22, 2019 20:22
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants