fregante/webext-storage-cache

`staleWhileRevalidate` may cause unhandledrejection errors

Closed

#49 opened on Oct 14, 2024

 (0 comments) (0 reactions) (0 assignees)JavaScript (4 forks)github user discovery
help wanted

Repository metrics

Stars
 (82 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

This is due to the async setTimeout(getSet) call. If the getter throws, then this error cannot be caught.

I'm not sure of how to handle this. Maybe:

  • item.onAsyncRejection(cb)
  • swallowAsyncRejections: true (default)
  • just use a global unhandledrejection handler, which loses the context/origin
    • maybe the errors can still be caught/rewrapped to add context

Contributor guide