-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Log a warning when a handler returns nil without calling c.Render(200... #25
Comments
@Baggerone this one is related with the buffalo-pop middleware. Moving the issue there. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days. |
It seems like this issue is similar to gobuffalo/buffalo#2300 (fixed by gobuffalo/buffalo#2334). The current behavior is something like the following: When the controller returns an error:
When the controller panic:
When the controller returns nil:
All of them end with rollback, and the first two cases will put two lines of logs. Access log in INFO, and ERROR log. The case of nil is somewhat tricky, but still, there is a log line with |
Finally, the implementation is that Buffalo's hidden middleware will log it when the status code was not set but the handler returns nil. This log is Debug level since it could be verbose in the production if a user still wants to use this behavior though. |
Description
Logging improvement request.
There seems to be no log that indicates that a buffalo handler returned a nil error without first calling c.Render() with a 200-300 response code.
This would be very helpful when using transactions, so that there is an indication of why the transaction is rolled back despite no error being triggered in the code.
(I ignorantly wasted several hours trying to troubleshoot my situation.)
Steps to Reproduce the Problem
app.Use(popmw.Transaction(models.DB))
return nil
Expected Behavior
A log to say that the transaction was cancelled because nil was returned from the handler without c.Render(200...) being called first.
Actual Behavior
The database will not include the entry that was supposed to have been created, but the logs will have no warning or error to tell you that the transaction was cancelled.
Info
Please run
buffalo info
and paste the information below where it says "PASTE_HERE".The text was updated successfully, but these errors were encountered: