Moving HTTP error handling from root module to app.py. Resolves #9.