fix(fs/s3#copy): normalize error: no such key → ENOENT (#6388)
This commit is contained in:
parent
dca3f39156
commit
d8e01b2867
@ -155,6 +155,14 @@ export default class S3Handler extends RemoteHandlerAbstract {
|
||||
if (e.name === 'EntityTooLarge') {
|
||||
return this._multipartCopy(oldPath, newPath)
|
||||
}
|
||||
// normalize this error code
|
||||
if (e.name === 'NoSuchKey') {
|
||||
const error = new Error(`ENOENT: no such file or directory '${oldPath}'`)
|
||||
error.cause = e
|
||||
error.code = 'ENOENT'
|
||||
error.path = oldPath
|
||||
throw error
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user