mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 23:20:47 +02:00
Make 404 error handling on deletes more specific
The GCS persistor error handler ignores 404 errors on deletes. However, the net is too wide cast, and 404 errors coming from the dual-bucket lifecycle mechanism are also ignored.
This commit is contained in:
@@ -200,17 +200,21 @@ module.exports = class GcsPersistor extends AbstractPersistor {
|
||||
if (this.settings.unlockBeforeDelete) {
|
||||
await file.setMetadata({ eventBasedHold: false })
|
||||
}
|
||||
await file.delete()
|
||||
try {
|
||||
await file.delete()
|
||||
} catch (err) {
|
||||
// ignore 404s: it's fine if the file doesn't exist.
|
||||
if (err.code !== 404) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
const error = PersistorHelper.wrapError(
|
||||
throw PersistorHelper.wrapError(
|
||||
err,
|
||||
'error deleting GCS object',
|
||||
{ bucketName, key },
|
||||
WriteError
|
||||
)
|
||||
if (!(error instanceof NotFoundError)) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user