Merge pull request #5668 from backstage/iameap/cache-improvements

Handle/log cache connection errors and allow integrators to pass custom handlers
This commit is contained in:
Fredrik Adelöw
2021-05-19 21:46:46 +02:00
committed by GitHub
6 changed files with 133 additions and 7 deletions
+17
View File
@@ -0,0 +1,17 @@
---
'@backstage/backend-common': patch
---
All cache-related connection errors are now handled and logged by the cache manager. App Integrators may provide an optional error handler when instantiating the cache manager if custom error handling is needed.
```typescript
// Providing an error handler
const cacheManager = CacheManager.fromConfig(config, {
onError: e => {
if (isSomehowUnrecoverable(e)) {
gracefullyShutThingsDown();
process.exit(1);
}
},
});
```