def error(e): url = request.url collection = Structure(url) collection.appendLinks(describeAPI(url)) if (e.code == 404): collection.setError(getHTTPError(404, request)) elif(e.code == 405): collection.setError(getHTTPError(405, request)) else: collection.setError(getHTTPError(5, e)) return packageResponse(collection) collection.setError(getError(6, e)) return packageResponse(collection)