Skip to main content

S3Error

Struct S3Error 

Source
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

Source

pub fn status(&self) -> StatusCode

Returns the HTTP status that will be used for the error response.

Source

pub fn code(&self) -> &'static str

Returns the S3 error code.

Source

pub fn message(&self) -> &str

Returns the user-facing S3 error message.

Source

pub fn resource(&self) -> Option<&str>

Returns the optional S3 resource path included in the XML body.

Source

pub fn invalid_request(message: impl Into<String>) -> Self

Returns a 400 InvalidRequest error.

Source

pub fn invalid_argument(message: impl Into<String>) -> Self

Returns a 400 InvalidArgument error.

Source

pub fn malformed_xml(message: impl Into<String>) -> Self

Returns a 400 MalformedXML error.

Source

pub fn no_such_bucket(bucket: impl Into<String>) -> Self

Returns a 404 NoSuchBucket error for a bucket name.

Source

pub fn no_such_key() -> Self

Returns a 404 NoSuchKey error.

Source

pub fn access_denied(message: impl Into<String>) -> Self

Returns a 403 AccessDenied error.

Source

pub fn authorization_header_malformed(message: impl Into<String>) -> Self

Returns a 400 AuthorizationHeaderMalformed error.

Source

pub fn signature_does_not_match() -> Self

Returns a 403 SignatureDoesNotMatch error.

Source

pub fn request_time_too_skewed() -> Self

Returns a 403 RequestTimeTooSkewed error.

Source

pub fn missing_content_length() -> Self

Returns a 411 MissingContentLength error.

Source

pub fn bad_digest(message: impl Into<String>) -> Self

Returns a 400 BadDigest error.

Source

pub fn no_such_upload() -> Self

Returns a 404 NoSuchUpload error.

Source

pub fn invalid_part(message: impl Into<String>) -> Self

Returns a 400 InvalidPart error.

Source

pub fn entity_too_small(message: impl Into<String>) -> Self

Returns a 400 EntityTooSmall error.

Source

pub fn entity_too_large(message: impl Into<String>) -> Self

Returns a 413 EntityTooLarge error.

Source

pub fn slow_down(message: impl Into<String>) -> Self

Returns a 503 SlowDown error.

Source

pub fn invalid_range(message: impl Into<String>) -> Self

Returns a 416 InvalidRange error.

Source

pub fn precondition_failed(message: impl Into<String>) -> Self

Returns a 412 PreconditionFailed error.

Source

pub fn method_not_allowed() -> Self

Returns a 405 MethodNotAllowed error with the endpoint’s Allow header.

Source

pub fn not_implemented(message: impl Into<String>) -> Self

Returns a 501 NotImplemented error.

Source

pub fn internal(message: impl Into<String>) -> Self

Returns a 500 InternalError error.

Source

pub fn with_resource(self, resource: impl Into<String>) -> Self

Attaches the S3 resource path included in the XML error body.

Source

pub fn with_header(self, name: HeaderName, value: HeaderValue) -> Self

Attaches an HTTP response header to the eventual error response.

Source

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 Clone for S3Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for S3Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IntoResponse for S3Error

Source§

fn into_response(self) -> Response

Create a response.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T, S> Handler<IntoResponseHandler, S> for T
where T: IntoResponse + Clone + Send + Sync + 'static,

Source§

type Future = Ready<Response<Body>>

The type of future calling this handler returns.
Source§

fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future

Call the handler with the given request.
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>>,

Apply a tower::Layer to the handler. Read more
Source§

fn with_state(self, state: S) -> HandlerService<Self, T, S>

Convert the handler into a Service by providing the state
Source§

impl<H, T> HandlerWithoutStateExt<T> for H
where H: Handler<T, ()>,

Source§

fn into_service(self) -> HandlerService<H, T, ()>

Convert the handler into a Service and no state.
Source§

fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>

Convert the handler into a MakeService and no state. Read more
Source§

fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>

Convert the handler into a MakeService which stores information about the incoming connection and has no state. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more