Skip to content

Reconsider RetryPolicy errors for non-retriable responses #2435

@chlowell

Description

@chlowell

RetryPolicy currently returns an error when it receives a non-retriable, non-2xx response:

if !RETRY_STATUSES.contains(&status) {
debug!(
"server returned error status which will not be retried: {}",
status
);
// Server didn't return a status we retry on so return early
let error = Error::full(
error_kind,
http_error,
format!(
"server returned error status which will not be retried: {status}"
),
);
return Err(error);

In the abstract, this is strange because the policy's responsibility is to obtain a non-retriable response, retrying requests as necessary according to its configuration. Interpreting those responses is the caller's responsibility. Concretely, this behavior creates practical difficulties for callers who expect such a response (e.g., a client may elicit an authentication challenge) or want to handle it with a different error type.

Metadata

Metadata

Labels

Azure.CoreThe azure_core crateClientThis issue points to a problem in the data-plane of the library.CodeGenIssues that relate to code generation

Projects

Status

Not Started

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions