-
Notifications
You must be signed in to change notification settings - Fork 35
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
Better error messages #115
Conversation
1157dc0
to
e89de2a
Compare
* fix test compilation * fix aliases on member page * add tests for aliases on member.GetByID and ByFeed * fix admin tests * use webassert helper for flash messages * fix flashes
c58d7a9
to
8ff4adf
Compare
but until then it might be nice to include a _previous_ data from the rendere with an url of where to go. | ||
--> | ||
<a href="javascript:history.back()" class="btn btn-primary">Back</a> | ||
<a href="{{.BackURL}}" class="btn btn-primary">Back</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Go looks good, and I took a look at the styles, they seem simple and obvious, I don't think we need to improve the looks (an error anyway looks unpleasant, by design). What's important is that it's a consistent style, and that it clearly communicates an error.
Oh, and can other pages use the |
Thanks! merging then :)
Not yet, right now it's handled in the errorhandler, which also looks at the status code to to a kinda-sane thing: Where would you want to use it? |
🎉 |
Remove member confirmation, revoke invite confirmation, maybe other places. |
fixes #66
fixes #23
Most importantly: I added
errhandler.go
andflashes.go
toweb/errors
, these uselocalizeError()
which translates a few hardcoded error messages to the users locale. I updated the english defaults accordingly.Most of the handlers now have
flashes weberrors.FlashHelper
which has three methods:AddMessage(rw http.ResponseWriter, req *http.Request, label string)
AddError(rw http.ResponseWriter, req *http.Request, err error)
GetAll(rw http.ResponseWriter, req *http.Request) ([]FlashMessage, error)
To render these there is a new base template
flashes.tmpl
which can be used with{{ tempalte "flashes" .}}
, See the overviews of admin/members, admin/aliases, etc.Noteworthy:
go.mindeco.de/http/[email protected]
now handles cookies automatically which made it possible to simplify quite a bit of the testing code that uses login and csrf.TODO: