layered-loader
Version:
Data loader with support for caching and fallback data sources
26 lines • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractNotificationConsumer = exports.DEFAULT_NOTIFICATION_ERROR_HANDLER = void 0;
/* c8 ignore next 3 */
const DEFAULT_NOTIFICATION_ERROR_HANDLER = (err, serverUuid, logger) => {
logger.error(`Notification consumer error for server UUID ${serverUuid}: ${err.message}`);
};
exports.DEFAULT_NOTIFICATION_ERROR_HANDLER = DEFAULT_NOTIFICATION_ERROR_HANDLER;
class AbstractNotificationConsumer {
// @ts-ignore
targetCache;
errorHandler;
serverUuid;
constructor(serverUuid, errorHandler) {
this.serverUuid = serverUuid;
this.errorHandler = errorHandler ?? exports.DEFAULT_NOTIFICATION_ERROR_HANDLER;
}
setTargetCache(targetCache) {
if (this.targetCache) {
throw new Error('Cannot modify already set target cache');
}
this.targetCache = targetCache;
}
}
exports.AbstractNotificationConsumer = AbstractNotificationConsumer;
//# sourceMappingURL=AbstractNotificationConsumer.js.map
;