#[non_exhaustive]pub enum Error {
AccessDeniedException(AccessDeniedException),
BadGatewayException(BadGatewayException),
GatewayTimeoutException(GatewayTimeoutException),
InternalServerException(InternalServerException),
InternalStreamFailure(InternalStreamFailure),
ModelStreamError(ModelStreamError),
PayloadTooLargeException(PayloadTooLargeException),
ResourceNotFoundException(ResourceNotFoundException),
ServiceUnavailableException(ServiceUnavailableException),
ThrottlingException(ThrottlingException),
Unhandled(Unhandled),
}Expand description
All possible error types for this service.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AccessDeniedException(AccessDeniedException)
The caller is not authorized to invoke this gateway. Invoking requires the sagemaker:InvokeGlobalInferenceGateway permission, or sagemaker:InvokeGlobalInferenceGatewayWithResponseStream for the streaming operation, on the gateway ARN. A message starting inference gateway means the inference gateway serving the model refused the request with a 401 or 403, for example for its customer identity token. Its status code is in the message (the response status is 403), and up to 256 bytes of its error message are quoted.
BadGatewayException(BadGatewayException)
502 – The gateway could not get a usable response from the inference gateway. The Message prefix says why: * Global Inference Gateway: could not reach the inference gateway: <reason> – the request could not be sent, or the connection closed before a response arrived (for example, the connection failed, or the inference gateway closed it after reading the request). * Global Inference Gateway: timed out waiting for the inference gateway – on the buffered operation, the inference gateway stopped sending partway through the response body and the gateway’s read timeout expired. (The same text on a GatewayTimeoutException means no response arrived.) * Any other Global Inference Gateway: message – the gateway ended a response before it was complete, for example because it exceeded the 10 MiB limit of the buffered operation, the request exceeded its maximum duration, or the inference gateway was taken out of service. * inference gateway: <status> <message> – the inference gateway serving the model returned a 502, 500, 503 or another 5xx error. Its status code is in the message (the response status is 502), and up to 256 bytes of its error message are quoted. * inference gateway: response ended unexpectedly – the inference gateway’s connection failed while it was sending the response. The inference gateway names a component in the prefix when it reports one: inference gateway ( <component> ): , where the component is config (the inference gateway’s configuration and proxy layer), scheduler (its request scheduler), model selector (its model selector) or model server (the model server). Not modeled as retryable: a 502 can mean the inference already ran, and the gateway may already have tried another inference gateway. Standard SDK retry modes may still retry a 5xx status, which would run (and bill) the inference again; set max attempts to 1 if a repeated inference is unacceptable.
GatewayTimeoutException(GatewayTimeoutException)
504 – The inference gateway did not respond in time. The Message prefix says whose time limit expired: * Global Inference Gateway: timed out waiting for the inference gateway – the gateway’s limit on the wait for the first part of the response. * inference gateway: <status> <message> – the inference gateway serving the model returned a 504, or a 408 because it timed out waiting for the request to arrive. Its status code is in the message (the response status is 504), and up to 256 bytes of its error message are quoted. The inference gateway names a component in the prefix when it reports one: inference gateway ( <component> ): , where the component is config (the inference gateway’s configuration and proxy layer), scheduler (its request scheduler), model selector (its model selector) or model server (the model server). Not modeled as retryable: a timeout does not prove the inference did not run, and the gateway may already have tried another inference gateway. Standard SDK retry modes may still retry a 5xx status, which could run (and bill) the inference again; set max attempts to 1 if a repeated inference is unacceptable.
InternalServerException(InternalServerException)
An unexpected internal failure occurred.
InternalStreamFailure(InternalStreamFailure)
A failure after the stream started. The Message says where it came from: Global Inference Gateway: when a gateway time limit expired or the inference gateway was taken out of service, or inference gateway: response ended unexpectedly when the inference gateway’s connection failed while it was sending the response. The stream ends after this event.
ModelStreamError(ModelStreamError)
Reserved for a model error during the stream. Not currently sent; a failure after the stream starts is reported as InternalStreamFailure.
PayloadTooLargeException(PayloadTooLargeException)
The request body exceeds the 10 MiB limit. Reduce the size of the payload and send the request again.
ResourceNotFoundException(ResourceNotFoundException)
No gateway with this ID exists in this account and Region, or no target of the gateway serves the model named in the request body. A model that is served but has no available target right now returns ServiceUnavailableException instead. A message starting inference gateway means the inference gateway serving the model returned a 404; up to 256 bytes of its error message are quoted.
The service is temporarily unable to serve the request, for example because no capacity is available for the requested model. The request was not dispatched for inference. A 503 returned by the inference gateway serving the model after dispatch is reported as BadGatewayException, with the 503 in its Message, not as this error.
ThrottlingException(ThrottlingException)
The request was throttled before it was dispatched for inference. Retry the request with backoff, after the Retry-After seconds when the response carries one. A message starting inference gateway means the last inference gateway tried for the model returned a 429. The gateway may have tried others first, and they may have failed for other reasons. Up to 256 bytes of its error message are quoted.
Unhandled(Unhandled)
Matching Unhandled directly is not forwards compatible. Instead, match using a variable wildcard pattern and check .code():
err if err.code() == Some("SpecificExceptionCode") => { /* handle the error */ }
See ProvideErrorMetadata for what information is available for the error.
An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Source§impl From<BuildError> for Error
impl From<BuildError> for Error
Source§fn from(value: BuildError) -> Self
fn from(value: BuildError) -> Self
Source§impl From<InvokeGlobalInferenceGatewayError> for Error
impl From<InvokeGlobalInferenceGatewayError> for Error
Source§fn from(err: InvokeGlobalInferenceGatewayError) -> Self
fn from(err: InvokeGlobalInferenceGatewayError) -> Self
Source§impl From<InvokeGlobalInferenceGatewayWithResponseStreamError> for Error
impl From<InvokeGlobalInferenceGatewayWithResponseStreamError> for Error
Source§fn from(err: InvokeGlobalInferenceGatewayWithResponseStreamError) -> Self
fn from(err: InvokeGlobalInferenceGatewayWithResponseStreamError) -> Self
Source§impl From<ResponseStreamError> for Error
impl From<ResponseStreamError> for Error
Source§fn from(err: ResponseStreamError) -> Self
fn from(err: ResponseStreamError) -> Self
Source§impl<R> From<SdkError<InvokeGlobalInferenceGatewayError, R>> for Error
impl<R> From<SdkError<InvokeGlobalInferenceGatewayError, R>> for Error
Source§fn from(err: SdkError<InvokeGlobalInferenceGatewayError, R>) -> Self
fn from(err: SdkError<InvokeGlobalInferenceGatewayError, R>) -> Self
Source§impl<R> From<SdkError<InvokeGlobalInferenceGatewayWithResponseStreamError, R>> for Error
impl<R> From<SdkError<InvokeGlobalInferenceGatewayWithResponseStreamError, R>> for Error
Source§fn from(
err: SdkError<InvokeGlobalInferenceGatewayWithResponseStreamError, R>,
) -> Self
fn from( err: SdkError<InvokeGlobalInferenceGatewayWithResponseStreamError, R>, ) -> Self
Source§impl<R> From<SdkError<ResponseStreamError, R>> for Error
impl<R> From<SdkError<ResponseStreamError, R>> for Error
Source§fn from(err: SdkError<ResponseStreamError, R>) -> Self
fn from(err: SdkError<ResponseStreamError, R>) -> Self
Source§impl ProvideErrorMetadata for Error
impl ProvideErrorMetadata for Error
Source§fn meta(&self) -> &ErrorMetadata
fn meta(&self) -> &ErrorMetadata
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Error
impl Move for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);