Skip to content

Commit 161741e

Browse files
committed
fix(cleanup): clear whole store on error
1 parent 6d63b5b commit 161741e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/loader/cleanup-entries.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ export async function cleanupEntries(
4747
context.logger.error(
4848
`The collection is not accessible without superuser rights. Please provide superuser credentials in the config.`
4949
);
50-
return;
50+
} else {
51+
const reason = await collectionRequest
52+
.json()
53+
.then((data) => data.message);
54+
const errorMessage = `Fetching ids failed with status code ${collectionRequest.status}.\nReason: ${reason}`;
55+
context.logger.error(errorMessage);
5156
}
5257

53-
const reason = await collectionRequest
54-
.json()
55-
.then((data) => data.message);
56-
const errorMessage = `Fetching ids failed with status code ${collectionRequest.status}.\nReason: ${reason}`;
57-
context.logger.error(errorMessage);
58+
// Remove all entries from the store
59+
context.logger.info(`Removing all entries from the store.`);
60+
context.store.clear();
5861
return;
5962
}
6063

0 commit comments

Comments
 (0)