pub struct S3Error { /* private fields */ }Expand description
S3 XML error response.
S3Error keeps the HTTP status, S3 error code, user-facing message,
optional resource, and extra response headers together until the HTTP
boundary converts it to an XML response. Constructors are named after the
S3 error code or behavior they represent.
Implementations§
Source§impl S3Error
impl S3Error
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the HTTP status that will be used for the error response.
Sourcepub fn resource(&self) -> Option<&str>
pub fn resource(&self) -> Option<&str>
Returns the optional S3 resource path included in the XML body.
Sourcepub fn invalid_request(message: impl Into<String>) -> Self
pub fn invalid_request(message: impl Into<String>) -> Self
Returns a 400 InvalidRequest error.
Sourcepub fn invalid_argument(message: impl Into<String>) -> Self
pub fn invalid_argument(message: impl Into<String>) -> Self
Returns a 400 InvalidArgument error.
Sourcepub fn malformed_xml(message: impl Into<String>) -> Self
pub fn malformed_xml(message: impl Into<String>) -> Self
Returns a 400 MalformedXML error.
Sourcepub fn no_such_bucket(bucket: impl Into<String>) -> Self
pub fn no_such_bucket(bucket: impl Into<String>) -> Self
Returns a 404 NoSuchBucket error for a bucket name.
Sourcepub fn no_such_key() -> Self
pub fn no_such_key() -> Self
Returns a 404 NoSuchKey error.
Sourcepub fn access_denied(message: impl Into<String>) -> Self
pub fn access_denied(message: impl Into<String>) -> Self
Returns a 403 AccessDenied error.
Returns a 400 AuthorizationHeaderMalformed error.
Sourcepub fn signature_does_not_match() -> Self
pub fn signature_does_not_match() -> Self
Returns a 403 SignatureDoesNotMatch error.
Sourcepub fn request_time_too_skewed() -> Self
pub fn request_time_too_skewed() -> Self
Returns a 403 RequestTimeTooSkewed error.
Sourcepub fn missing_content_length() -> Self
pub fn missing_content_length() -> Self
Returns a 411 MissingContentLength error.
Sourcepub fn bad_digest(message: impl Into<String>) -> Self
pub fn bad_digest(message: impl Into<String>) -> Self
Returns a 400 BadDigest error.
Sourcepub fn no_such_upload() -> Self
pub fn no_such_upload() -> Self
Returns a 404 NoSuchUpload error.
Sourcepub fn invalid_part(message: impl Into<String>) -> Self
pub fn invalid_part(message: impl Into<String>) -> Self
Returns a 400 InvalidPart error.
Sourcepub fn entity_too_small(message: impl Into<String>) -> Self
pub fn entity_too_small(message: impl Into<String>) -> Self
Returns a 400 EntityTooSmall error.
Sourcepub fn entity_too_large(message: impl Into<String>) -> Self
pub fn entity_too_large(message: impl Into<String>) -> Self
Returns a 413 EntityTooLarge error.
Sourcepub fn invalid_range(message: impl Into<String>) -> Self
pub fn invalid_range(message: impl Into<String>) -> Self
Returns a 416 InvalidRange error.
Sourcepub fn precondition_failed(message: impl Into<String>) -> Self
pub fn precondition_failed(message: impl Into<String>) -> Self
Returns a 412 PreconditionFailed error.
Sourcepub fn method_not_allowed() -> Self
pub fn method_not_allowed() -> Self
Returns a 405 MethodNotAllowed error with the endpoint’s Allow header.
Sourcepub fn not_implemented(message: impl Into<String>) -> Self
pub fn not_implemented(message: impl Into<String>) -> Self
Returns a 501 NotImplemented error.
Sourcepub fn with_resource(self, resource: impl Into<String>) -> Self
pub fn with_resource(self, resource: impl Into<String>) -> Self
Attaches the S3 resource path included in the XML error body.
Sourcepub fn with_header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn with_header(self, name: HeaderName, value: HeaderValue) -> Self
Attaches an HTTP response header to the eventual error response.
Sourcepub fn into_response_with_request_id(self, request_id: &RequestId) -> Response
pub fn into_response_with_request_id(self, request_id: &RequestId) -> Response
Converts the error into an S3 XML response using a known request ID.
Trait Implementations§
Source§impl IntoResponse for S3Error
impl IntoResponse for S3Error
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Auto Trait Implementations§
impl Freeze for S3Error
impl RefUnwindSafe for S3Error
impl Send for S3Error
impl Sync for S3Error
impl Unpin for S3Error
impl UnsafeUnpin for S3Error
impl UnwindSafe for S3Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Service by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
MakeService and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
MakeService which stores information
about the incoming connection and has no state. Read more