#[non_exhaustive]pub enum UploadError {
UnexpectedRewind {
offset: u64,
persisted: u64,
},
TooMuchProgress {
sent: u64,
persisted: u64,
},
}Expand description
An unrecoverable problem in the upload protocol.
§Example
use std::error::Error as _;
let upload = client
.upload_object("projects/_/buckets/my-bucket", "my-object", "hello world")
.with_if_generation_not_match(0);
match upload.send().await {
Ok(object) => println!("Successfully uploaded the object"),
Err(error) if error.is_serialization() => {
println!("Some problem {error:?} sending the data to the service");
if let Some(m) = error.source().and_then(|e| e.downcast_ref::<UploadError>()) {
println!("{m}");
}
},
Err(e) => return Err(e.into()), // not handled in this example
}§Troubleshoot
These errors indicate a bug in the resumable upload protocol implementation, either in the service or the client library. Neither are expected to be common, but neither are impossible. We recommend you open a bug, there is little you could do to recover from this problem.
While it is customary to panic!() when a bug triggers a problem, we do not
believe it is appropriate to do so in this case, as the invariants involve
different machines and the upload protocol.
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.
Trait Implementations§
Source§impl Debug for UploadError
impl Debug for UploadError
Source§impl Display for UploadError
impl Display for UploadError
Source§impl Error for UploadError
impl Error for UploadError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for UploadError
impl RefUnwindSafe for UploadError
impl Send for UploadError
impl Sync for UploadError
impl Unpin for UploadError
impl UnwindSafe for UploadError
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.