Table of Contents

Class CloudflareR2Exception

Namespace
Cloudflare.NET.R2.Exceptions
Assembly
Cloudflare.NET.R2.dll

Represents the base class for exceptions thrown by the Cloudflare.NET.R2 client.

It captures partial metrics accumulated before the failure, allowing for accurate cost tracking even in error scenarios.

public abstract class CloudflareR2Exception : Exception, ISerializable
Inheritance
CloudflareR2Exception
Implements
Derived
Inherited Members

Constructors

CloudflareR2Exception(string, R2Result, Exception?)

Initializes a new instance of the CloudflareR2Exception class.

protected CloudflareR2Exception(string message, R2Result partialMetrics, Exception? innerException = null)

Parameters

message string

The message that describes the error.

partialMetrics R2Result

The metrics accumulated before the error occurred.

innerException Exception

The exception that is the cause of the current exception, or a null reference.

Properties

PartialMetrics

Gets the billable metrics that were consumed before the exception was thrown. This is critical for accurate usage tracking, even in failure scenarios.

public R2Result PartialMetrics { get; }

Property Value

R2Result