Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2015 21:04
Show Gist options
  • Save anonymous/a69c01c61f6673e12146 to your computer and use it in GitHub Desktop.
Save anonymous/a69c01c61f6673e12146 to your computer and use it in GitHub Desktop.
# ==================================================
# If an error is raised while loading the module,
# and it isn't handled (or it is re-raised), it
# will go straight to the WSGI server.
# ==================================================
model = Model()
try:
model.load()
except Exception as ex:
# Handle the error here - log and re-raise to the
# WSGI server, retry, or whatever...
pass
resource = Resource(model)
api = falcon.API()
api.add_route('/foo', resource)
# ==================================================
# At this point the module has been parsed and
# loaded by the WSGI server. Future errors raised
# inside your app will go through Falcon's error
# handling logic.
# ==================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment