Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33027565
D8100.1768398177.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8100.1768398177.diff
View Options
diff --git a/services/blob/src/s3.rs b/services/blob/src/s3.rs
--- a/services/blob/src/s3.rs
+++ b/services/blob/src/s3.rs
@@ -3,12 +3,55 @@
model::{CompletedMultipartUpload, CompletedPart},
output::CreateMultipartUploadOutput,
types::ByteStream,
+ Error as S3Error,
};
use std::{
ops::{Bound, RangeBounds},
sync::Arc,
};
+#[derive(
+ Debug, derive_more::Display, derive_more::From, derive_more::Error,
+)]
+pub enum Error {
+ #[display(...)]
+ AwsSdk(S3Error),
+ #[display(...)]
+ ByteStream(std::io::Error),
+ #[display(...)]
+ InvalidPath(S3PathError),
+ #[display(fmt = "There are no parts to upload")]
+ EmptyUpload,
+ #[display(fmt = "Missing upload ID")]
+ MissingUploadID,
+}
+
+#[derive(Debug, derive_more::Error)]
+pub enum S3PathError {
+ MissingSeparator(#[error(ignore)] String),
+ MissingBucketName(#[error(ignore)] String),
+ MissingObjectName(#[error(ignore)] String),
+}
+
+impl std::fmt::Display for S3PathError {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ match self {
+ S3PathError::MissingSeparator(path) => {
+ write!(f, "S3 path: [{}] should contain the '/' separator", path)
+ }
+ S3PathError::MissingBucketName(path) => {
+ write!(f, "Expected bucket name in S3 path: [{}]", path)
+ }
+ S3PathError::MissingObjectName(path) => {
+ write!(f, "Expected object name in S3 path: [{}]", path)
+ }
+ }
+ }
+}
+
+#[allow(unused)]
+type S3Result<T> = Result<T, Error>;
+
/// A helper structure representing an S3 object path
#[derive(Clone, Debug)]
pub struct S3Path {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 1:42 PM (7 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5932258
Default Alt Text
D8100.1768398177.diff (1 KB)
Attached To
Mode
D8100: [blob-service] Introduce S3-specific error types
Attached
Detach File
Event Timeline
Log In to Comment