fix: improve NoSuchKey error handling in S3 mock
This commit is contained in:
parent
af7a1e1cbc
commit
c474f3692a
1 changed files with 4 additions and 2 deletions
|
|
@ -240,8 +240,10 @@ function handleGetObject(command: any) {
|
|||
|
||||
if (!bucket.objects.has(Key)) {
|
||||
console.log(`Object ${Key} not found in bucket ${Bucket}`)
|
||||
// Return null for non-existent objects instead of rejecting
|
||||
return Promise.reject(new Error(`NoSuchKey: The specified key does not exist.`))
|
||||
// Create proper NoSuchKey error that matches AWS SDK structure
|
||||
const error = new Error(`NoSuchKey: The specified key does not exist.`)
|
||||
error.name = 'NoSuchKey'
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
const object = bucket.objects.get(Key)!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue