jhauserw3241 / cdcdb-webserver

Python3/Flask web server for DB final project
https://cdcdb.system33.pw
1 stars 1 forks source link

Make error module that takes an optional title and optional list of errors #54

Open pastly opened 7 years ago

pastly commented 7 years ago

And use it instead of aborting so much.

jhauserw3241 commented 7 years ago

Can you please explain more of what you meant when you created this issue?

pastly commented 7 years ago

We abort(404) a lot, where 404 is some HTTP status code. This produces those ugly white error pages.

Instead of aborting, I suggest an error module, errors.py or an error page template. Spit balling ideas here:

example pseudo code

def people.show(id):
    if not can_show(session, id):
        title = "Permission denied"
        errors = ["You do not have permission to see that person"]
        code = 403
        return redirect(url_for('error', title=title, errors=errors), code=code)

This example uses the template idea.