pub struct S3Error {
pub code: S3ErrorCode,
pub message: String,
pub resource: Option<String>,
pub request_id: Option<String>,
pub status_code: StatusCode,
pub source: Option<Box<dyn Error + Send + Sync>>,
pub headers: Option<Box<Vec<(String, String)>>>,
}Expand description
An S3 error response.
Fields§
§code: S3ErrorCodeThe error code.
message: StringA human-readable error message.
resource: Option<String>The resource that caused the error.
request_id: Option<String>The request ID.
status_code: StatusCodeThe HTTP status code.
source: Option<Box<dyn Error + Send + Sync>>The underlying source error, if any.
headers: Option<Box<Vec<(String, String)>>>Extra HTTP headers to include in the error response.
Boxed to minimize the size of S3Error on the common (header-free) path.
Implementations§
Source§impl S3Error
impl S3Error
Sourcepub fn new(code: S3ErrorCode) -> Self
pub fn new(code: S3ErrorCode) -> Self
Create a new S3Error from an error code.
Sourcepub fn with_message(code: S3ErrorCode, message: impl Into<String>) -> Self
pub fn with_message(code: S3ErrorCode, message: impl Into<String>) -> Self
Create a new S3Error with a custom message.
Sourcepub fn with_resource(self, resource: impl Into<String>) -> Self
pub fn with_resource(self, resource: impl Into<String>) -> Self
Set the resource that caused this error.
Sourcepub fn with_request_id(self, request_id: impl Into<String>) -> Self
pub fn with_request_id(self, request_id: impl Into<String>) -> Self
Set the request ID.
Sourcepub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
pub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
Set the source error.
Sourcepub fn with_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Add an extra HTTP header to the error response.
Sourcepub fn no_such_bucket(bucket_name: impl Into<String>) -> Self
pub fn no_such_bucket(bucket_name: impl Into<String>) -> Self
Create a NoSuchBucket error.
Sourcepub fn no_such_key(key: impl Into<String>) -> Self
pub fn no_such_key(key: impl Into<String>) -> Self
Create a NoSuchKey error.
Sourcepub fn no_such_upload(upload_id: impl Into<String>) -> Self
pub fn no_such_upload(upload_id: impl Into<String>) -> Self
Create a NoSuchUpload error.
Sourcepub fn no_such_version(version_id: impl Into<String>) -> Self
pub fn no_such_version(version_id: impl Into<String>) -> Self
Create a NoSuchVersion error.
Sourcepub fn bucket_already_exists(bucket_name: impl Into<String>) -> Self
pub fn bucket_already_exists(bucket_name: impl Into<String>) -> Self
Create a BucketAlreadyExists error.
Sourcepub fn bucket_already_owned_by_you(bucket_name: impl Into<String>) -> Self
pub fn bucket_already_owned_by_you(bucket_name: impl Into<String>) -> Self
Create a BucketAlreadyOwnedByYou error.
Sourcepub fn bucket_not_empty(bucket_name: impl Into<String>) -> Self
pub fn bucket_not_empty(bucket_name: impl Into<String>) -> Self
Create a BucketNotEmpty error.
Sourcepub fn access_denied(resource: impl Into<String>) -> Self
pub fn access_denied(resource: impl Into<String>) -> Self
Create a AccessDenied error.
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Create a InternalError error.
Sourcepub fn invalid_argument(message: impl Into<String>) -> Self
pub fn invalid_argument(message: impl Into<String>) -> Self
Create a InvalidArgument error.
Sourcepub fn invalid_bucket_name(bucket_name: impl Into<String>) -> Self
pub fn invalid_bucket_name(bucket_name: impl Into<String>) -> Self
Create a InvalidBucketName error.
Sourcepub fn invalid_range(range: impl Into<String>) -> Self
pub fn invalid_range(range: impl Into<String>) -> Self
Create a InvalidRange error.
Sourcepub fn invalid_part(part_info: impl Into<String>) -> Self
pub fn invalid_part(part_info: impl Into<String>) -> Self
Create a InvalidPart error.
Sourcepub fn invalid_part_order(detail: impl Into<String>) -> Self
pub fn invalid_part_order(detail: impl Into<String>) -> Self
Create a InvalidPartOrder error.
Sourcepub fn malformed_xml(detail: impl Into<String>) -> Self
pub fn malformed_xml(detail: impl Into<String>) -> Self
Create a MalformedXML error.
Sourcepub fn method_not_allowed(method: impl Into<String>) -> Self
pub fn method_not_allowed(method: impl Into<String>) -> Self
Create a MethodNotAllowed error.
Sourcepub fn not_implemented(detail: impl Into<String>) -> Self
pub fn not_implemented(detail: impl Into<String>) -> Self
Create a NotImplemented error.
Sourcepub fn precondition_failed(condition: impl Into<String>) -> Self
pub fn precondition_failed(condition: impl Into<String>) -> Self
Create a PreconditionFailed error.
Sourcepub fn signature_does_not_match(detail: impl Into<String>) -> Self
pub fn signature_does_not_match(detail: impl Into<String>) -> Self
Create a SignatureDoesNotMatch error.
Trait Implementations§
Source§impl Error for S3Error
impl Error for S3Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()