@fedify/fedify 1.5.0-dev.749 → 1.5.0-dev.751

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.md CHANGED
@@ -73,6 +73,9 @@ To be released.
73
73
  - Updated *uri-template-router* to 0.0.17 which fixes bundler errors on
74
74
  Rollup. [[#221]]
75
75
 
76
+ - Improved error handling and logging for document loader when KV store
77
+ operations fail. [[#223] by Revath S Kumar]
78
+
76
79
  - Fixed a bug of the `fedify inbox` command where it had failed to render
77
80
  the web interface when the `fedify` command was installed using
78
81
  `deno install` command from JSR.
@@ -98,6 +101,7 @@ To be released.
98
101
  [#215]: https://github.com/fedify-dev/fedify/pull/215
99
102
  [#220]: https://github.com/fedify-dev/fedify/issues/220
100
103
  [#221]: https://github.com/fedify-dev/fedify/issues/221
104
+ [#223]: https://github.com/fedify-dev/fedify/pull/223
101
105
  [multibase]: https://github.com/multiformats/js-multibase
102
106
 
103
107
 
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "@fedify/fedify",
3
- "version": "1.5.0-dev.749+75372a15",
3
+ "version": "1.5.0-dev.751+8b01be35",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts",
@@ -310,10 +310,23 @@ export function kvCache({ loader, kv, prefix, rules }) {
310
310
  if (match == null)
311
311
  return await loader(url);
312
312
  const key = [...keyPrefix, url];
313
- const cache = await kv.get(key);
313
+ let cache = undefined;
314
+ try {
315
+ cache = await kv.get(key);
316
+ }
317
+ catch (error) {
318
+ if (error instanceof Error) {
319
+ logger.warn("Failed to get the document of {url} from the KV cache: {error}", { url, error });
320
+ }
321
+ }
314
322
  if (cache == null) {
315
323
  const remoteDoc = await loader(url);
316
- await kv.set(key, remoteDoc, { ttl: match });
324
+ try {
325
+ await kv.set(key, remoteDoc, { ttl: match });
326
+ }
327
+ catch (error) {
328
+ logger.warn("Failed to save the document of {url} to the KV cache: {error}", { url, error });
329
+ }
317
330
  return remoteDoc;
318
331
  }
319
332
  return cache;