Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/cache-tags/provider/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ export abstract class AbstractErrorHandlingCacheTagsProvider implements CacheTag
return await fn();
} catch (error) {
const provider = this.providerName;
this.onError?.(error, { provider, method, args });

// Call onError callback if provided, but guard against exceptions
// to prevent masking the original provider error
try {
this.onError?.(error, { provider, method, args });
} catch (handlerError) {
console.error(`Error handler itself failed in ${provider}.${method}.`, { handlerError });
}

if (this.throwOnError) {
throw error;
Expand Down