frontend: simplify API and UI error handlers
The error handler was too chatty and required a lot of unnecessary work
to add a new exception to handle. The only thing that needs to be done
now is adding a new `@app.errorhandler` decorator for `handle_exceptions`
function. For cases where it's necessary, it still provides the flexibility
to return a customized error page or error message for that exception.