fides
fides copied to clipboard
Improve api_helpers error handling so errors are handled
Bug Description
The functions within api_helpers.py
should raise errors when returned codes are not within 200-299. For example, in get_server_resource
:
server_resource: Optional[FidesModel] = (
parse_dict(
resource_type=resource_type,
resource=raw_server_response.json(),
from_server=True,
)
if raw_server_response.status_code >= 200
and raw_server_response.status_code <= 299
else None
)
return server_resource
Additional context
We should raise an error for missing resources(400s) or service failures(500s). RIght now there is random logic with relies on this not throwing an error so we should refactor that. Leaving this as is could hide issues and the caller of api_helpers
should be able to handle a missing resource error and decide what to do with it.