aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_copy.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-05 17:07:36 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-05 17:07:36 +0100
commit168a90dfb5489d465d64f066f375e5d06bc1f08c (patch)
tree7fd1430cb52cf77a654ba93324b40c05d936f5a8 /src/api/s3_copy.rs
parentfb1e31add06ee3739fc95099aa5ffe96cf011e9c (diff)
downloadgarage-168a90dfb5489d465d64f066f375e5d06bc1f08c.tar.gz
garage-168a90dfb5489d465d64f066f375e5d06bc1f08c.zip
Fix some error codes
Diffstat (limited to 'src/api/s3_copy.rs')
-rw-r--r--src/api/s3_copy.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/api/s3_copy.rs b/src/api/s3_copy.rs
index 4ede8230..7952dae8 100644
--- a/src/api/s3_copy.rs
+++ b/src/api/s3_copy.rs
@@ -27,14 +27,14 @@ pub async fn handle_copy(
.object_table
.get(&source_bucket_id, &source_key.to_string())
.await?
- .ok_or(Error::NotFound)?;
+ .ok_or(Error::NoSuchKey)?;
let source_last_v = source_object
.versions()
.iter()
.rev()
.find(|v| v.is_complete())
- .ok_or(Error::NotFound)?;
+ .ok_or(Error::NoSuchKey)?;
let source_last_state = match &source_last_v.state {
ObjectVersionState::Complete(x) => x,
@@ -47,7 +47,7 @@ pub async fn handle_copy(
// Implement x-amz-metadata-directive: REPLACE
let old_meta = match source_last_state {
ObjectVersionData::DeleteMarker => {
- return Err(Error::NotFound);
+ return Err(Error::NoSuchKey);
}
ObjectVersionData::Inline(meta, _bytes) => meta,
ObjectVersionData::FirstBlock(meta, _fbh) => meta,
@@ -88,7 +88,7 @@ pub async fn handle_copy(
.version_table
.get(&source_last_v.uuid, &EmptyKey)
.await?;
- let source_version = source_version.ok_or(Error::NotFound)?;
+ let source_version = source_version.ok_or(Error::NoSuchKey)?;
// Write an "uploading" marker in Object table
// This holds a reference to the object in the Version table