python-flask handling application errors
问题 I've built a flask application and I try to catch unhandled application errors from my routes using the errorhandler decorator. I've a main.py which looks like this, app = Flask(__name__) api = Api(app) api.add_resource(Ping, '/ping') @app.errorhandler(500) def internal_server_error(error): print "caught internal server error" return "This page does not exist", 500 The route Ping is in another file, here is a sample version of the file class Ping(Resource): def get(self): raise return {}, 200