http api: Change error handling to werkzeug exceptions