<PackageReference Include="System.ClientModel" Version="1.10.0" />

System.ClientModel.Primitives.PipelineMessageClassifier

public abstract class PipelineMessageClassifier
A classifier that can evaluate a PipelineMessage in two ways. First, given an HTTP message, the PipelineMessageClassifier can determine whether the service response it holds should be considered an error response. Second, given an HTTP message and an optional pipeline exception, the classifier can determine whether or not the ClientPipeline should retry the request.
public static PipelineMessageClassifier Default { get; }

A default classifier instance. This classifier will classify a PipelineResponse with a status code of 4xx or 5xx as an error, and with a status code of 408, 429, 500, 502, 503 and 504 as retriable.

public static PipelineMessageClassifier Create(ReadOnlySpan<ushort> successStatusCodes)

Create an instance of a PipelineMessageClassifier from a collection of success status codes.

public abstract bool TryClassify(PipelineMessage message, out bool isError)

Attempt to evaluate whether the provided PipelineMessage contains a Response that the client should consider an error response.

public abstract bool TryClassify(PipelineMessage message, Exception exception, out bool isRetriable)

Attempt to evaluate whether the provided PipelineMessage contains a Response that indicates the client should retry the Request.