**fix(storage): handle additional errors in S3-compatible storage adapter**
- Updated error handling in `S3CompatibleStorage` to include checks for `NotFound` errors alongside `NoSuchKey` during lock operations. - Ensured robustness in determining lock existence and managing exceptions related to missing keys. **Purpose**: Improve resilience of the S3-compatible storage adapter by addressing additional error scenarios, ensuring accurate lock detection and stable operation.
This commit is contained in:
parent
195951e039
commit
ba1aaedd19
1 changed files with 9 additions and 3 deletions
|
|
@ -1757,8 +1757,11 @@ export class S3CompatibleStorage extends BaseStorage {
|
|||
return false
|
||||
}
|
||||
} catch (error: any) {
|
||||
// If HeadObject fails with NoSuchKey, the lock doesn't exist, which is good
|
||||
if (error.name !== 'NoSuchKey' && !error.message?.includes('NoSuchKey')) {
|
||||
// If HeadObject fails with NoSuchKey or NotFound, the lock doesn't exist, which is good
|
||||
if (error.name !== 'NoSuchKey' &&
|
||||
!error.message?.includes('NoSuchKey') &&
|
||||
error.name !== 'NotFound' &&
|
||||
!error.message?.includes('NotFound')) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
|
@ -1826,7 +1829,10 @@ export class S3CompatibleStorage extends BaseStorage {
|
|||
}
|
||||
} catch (error: any) {
|
||||
// If lock doesn't exist, that's fine
|
||||
if (error.name === 'NoSuchKey' || error.message?.includes('NoSuchKey')) {
|
||||
if (error.name === 'NoSuchKey' ||
|
||||
error.message?.includes('NoSuchKey') ||
|
||||
error.name === 'NotFound' ||
|
||||
error.message?.includes('NotFound')) {
|
||||
return
|
||||
}
|
||||
throw error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue