-
Notifications
You must be signed in to change notification settings - Fork 318
Description
In some cases it's useful for the caller to know the underlying http status code returned by requests. As of now, status codes never make their way back to the caller. This makes it difficult to decide how to proceed after a failed request. Just about every error that the API could throw is wrapped in something like {'errors': [...]}. This is fine for some use cases but unless we know every possible message that might end up in that datastruct we'll have a hard time knowing exactly how to proceed.
There is the option to set datadog.api._mute = False which will cause exceptions to bubble up to the caller. But in this case, things like ApiError are too broad to take make decisions on. e.g. I may wish to never retry a failed request due to a 403 or 404 but I certainly want to retry a request with that has failed with a 429.
#378 is related in that it's asking for a little more detail on failed requests. Maybe we pass both status codes and relevant headers back to the caller?