moved error handling to the wsgi layer