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

Improve error handling in controllers #324

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

markspolakovs
Copy link
Member

This PR makes various changes related to error handling in the HTTP controllers, most of which fall into one of two changes:

  1. Instead of either just logging the error and returning a blank screen or rendering a 404, delegate all controller error handling to Controllers.handleError, which takes care of logging it (with context), as well as rendering an appropriate template. (In the process this also introduces a 500 template.)
  2. Remove the error return from utils.RenderTemplate, since all callers were just doing a log.Println(err); return anyway. Instead have utils take care of logging it, with appropriate context.

Depends on UniversityRadioYork/myradio-go#64.

Fixes #180.

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.

Handle errors better
2 participants