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:
@@ -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);
|
||||
}
|
||||
},
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user