{"version":3,"file":"errors.mjs","names":[],"sources":["../../../../../../cache/src/errors.ts"],"sourcesContent":["/**\r\n * Thrown when a driver needs `indexedDB` and the runtime does not have\r\n * it — server-side rendering, a Node build step, a worker without the\r\n * API, or a browser running in a mode that blocks storage entirely.\r\n *\r\n * Failing loudly beats silently degrading to \"cache miss\": a cache that\r\n * quietly stops persisting looks like a working cache right up until the\r\n * data that was supposed to be there is gone.\r\n */\r\nexport class IndexedDBUnavailableError extends Error {\r\n  public constructor(\r\n    message = \"IndexedDB unavailable: `indexedDB` is not defined in this environment (server-side rendering, or storage is blocked). Use a different cache driver on the server.\"\r\n  ) {\r\n    super(message);\r\n    this.name = \"IndexedDBUnavailableError\";\r\n  }\r\n}\r\n\r\n/**\r\n * Thrown when the storage backend refuses a write because the origin is\r\n * out of quota.\r\n *\r\n * The browser's own `QuotaExceededError` is a `DOMException` whose\r\n * message says nothing about which cache overflowed, so it is wrapped\r\n * with the offending key and the original error kept as `cause`.\r\n */\r\nexport class CacheQuotaExceededError extends Error {\r\n  public constructor(\r\n    public readonly key: string,\r\n    public readonly cause?: unknown\r\n  ) {\r\n    super(\r\n      `Cache quota exceeded while writing \"${key}\": the storage backend is full. Remove entries, lower the TTL, or store less per key.`\r\n    );\r\n    this.name = \"CacheQuotaExceededError\";\r\n  }\r\n}\r\n\r\n/**\r\n * Thrown when a driver is asked to open a database that another tab is\r\n * holding open at an older version.\r\n */\r\nexport class IndexedDBBlockedError extends Error {\r\n  public constructor(databaseName: string) {\r\n    super(\r\n      `IndexedDB upgrade for \"${databaseName}\" is blocked by another open connection — close other tabs of this app and retry.`\r\n    );\r\n    this.name = \"IndexedDBBlockedError\";\r\n  }\r\n}\r\n"],"mappings":";;;;;;;;;;AASA,IAAa,4BAAb,cAA+C,MAAM;CACnD,AAAO,YACL,UAAU,qKACV;EACA,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;;;;AAUA,IAAa,0BAAb,cAA6C,MAAM;CACjD,AAAO,YACL,AAAgB,KAChB,AAAgB,OAChB;EACA,MACE,uCAAuC,IAAI,sFAC7C;EALgB;EACA;EAKhB,KAAK,OAAO;CACd;AACF;;;;;AAMA,IAAa,wBAAb,cAA2C,MAAM;CAC/C,AAAO,YAAY,cAAsB;EACvC,MACE,0BAA0B,aAAa,kFACzC;EACA,KAAK,OAAO;CACd;AACF"}