Line data Source code
1 : use crate::tenant::blob_io::WriteBlobError;
2 :
3 : #[derive(Debug, thiserror::Error)]
4 : pub enum PutError {
5 : #[error(transparent)]
6 : WriteBlob(WriteBlobError),
7 : #[error(transparent)]
8 : Other(anyhow::Error),
9 : }
10 :
11 : impl PutError {
12 0 : pub fn is_cancel(&self) -> bool {
13 0 : match self {
14 0 : PutError::WriteBlob(e) => e.is_cancel(),
15 0 : PutError::Other(_) => false,
16 : }
17 0 : }
18 0 : pub fn into_anyhow(self) -> anyhow::Error {
19 0 : match self {
20 0 : PutError::WriteBlob(e) => e.into_anyhow(),
21 0 : PutError::Other(e) => e,
22 : }
23 0 : }
24 : }
|