#[non_exhaustive]pub enum Error<T> {
Transport(T),
Http(Error),
Json(Error),
Io(Error),
Utf8(FromUtf8Error),
Api {
code: StatusCode,
headers: Vec<String>,
errors: Vec<String>,
},
Code {
code: StatusCode,
headers: Vec<String>,
body: String,
},
InvalidToken(TokenError),
Timeout(u64),
}Expand description
Error returned when interacting with a registry.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Transport(T)
Error from underlying transport.
Http(Error)
Error from http.
Json(Error)
Error from serializing the request payload and deserializing the response body (like response body didn’t match expected structure).
Io(Error)
Error from IO. Mostly from reading the tarball to upload.
Utf8(FromUtf8Error)
Response body was not valid utf8.
Api
Error from API response containing JSON field errors.details.
Code
Error from API response which didn’t have pre-programmed errors.details.
InvalidToken(TokenError)
Timeout(u64)
Server was unavailable and timed out. Happened when uploading a way too large tarball to crates.io.
Trait Implementations§
Source§impl<T> Error for Error<T>
impl<T> Error for Error<T>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl<T> From<FromUtf8Error> for Error<T>
impl<T> From<FromUtf8Error> for Error<T>
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Converts to this type from the input type.
Source§impl<T> From<TokenError> for Error<T>
impl<T> From<TokenError> for Error<T>
Source§fn from(source: TokenError) -> Self
fn from(source: TokenError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Freeze for Error<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Error<T>
impl<T> Send for Error<T>where
T: Send,
impl<T> Sync for Error<T>where
T: Sync,
impl<T> Unpin for Error<T>where
T: Unpin,
impl<T> UnsafeUnpin for Error<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for Error<T>
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
Mutably borrows from an owned value. Read more
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.