**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:
David Snelling 2025-07-30 15:47:26 -07:00
parent 195951e039
commit ba1aaedd19

View file

@ -1757,8 +1757,11 @@ export class S3CompatibleStorage extends BaseStorage {
return false return false
} }
} catch (error: any) { } catch (error: any) {
// If HeadObject fails with NoSuchKey, the lock doesn't exist, which is good // If HeadObject fails with NoSuchKey or NotFound, the lock doesn't exist, which is good
if (error.name !== 'NoSuchKey' && !error.message?.includes('NoSuchKey')) { if (error.name !== 'NoSuchKey' &&
!error.message?.includes('NoSuchKey') &&
error.name !== 'NotFound' &&
!error.message?.includes('NotFound')) {
throw error throw error
} }
} }
@ -1826,7 +1829,10 @@ export class S3CompatibleStorage extends BaseStorage {
} }
} catch (error: any) { } catch (error: any) {
// If lock doesn't exist, that's fine // 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 return
} }
throw error throw error