Closed alexander-bauer closed 7 years ago
duplicate email, invalid email, password too short, etc.
The way we should probably accomplish this is that for any page where an error may be thrown, catch the exceptions anywhere they might be thrown via user, and then re-render the same page with an error
key set to the exception. Then the template can be responsible for displaying the appropriate message.
Most notable place is the edit accounts page, but we should do this anywhere that we receive a user form.
@alexander-bauer
I finally found the cause (and replicated) this issue with #37. It's the redirect on valid submission in the views for def edit_accounts_page():
So the redirect function seems to fail on submitting a new user. There is a build error that says something like "could not build endpoint '/edit_accounts' did you mean 'edit_accounts_page' ?"
In my code, the route name is ~@ app.route('/edit_accounts')~ however the function fed into the redirect is return form.redirect(url_for('edit_accounts_page') which refers to the name of page function in the view.
I'm a bit confused because I've used the url_for before but it it normally works the way I think it does. I'm looking up this issue immediately now because it significantly hinders everyone else's progress, but do you have any idea why the function would fail?
wait no, I fixed that issue by redirecting to the page instead of the form. sweeet
I'm not convinced coverage is complete, yet, but I think it is as good as we're going to get it. Further improvements should be in the forms, to catch errors as early as possible, and not have to rely on try
/except
logic.
Need to explicitly write an exception message, fail cleanly, have the website still function, and not show console error message. May require passing message up to front end.