|
| 1 | +import { IgnorableError, isIgnorableError } from "utils/error"; |
1 | 2 | import { isBinaryContentType } from "./binary"; |
2 | 3 | import { debug, error, warn } from "./logger"; |
3 | 4 |
|
@@ -192,7 +193,11 @@ export default class S3Cache { |
192 | 193 | } as CacheHandlerValue; |
193 | 194 | } catch (e) { |
194 | 195 | // We can usually ignore errors here as they are usually due to cache not being found |
195 | | - debug("Failed to get fetch cache", e); |
| 196 | + if (isIgnorableError(e)) { |
| 197 | + debug("Failed to get fetch cache", e.message); |
| 198 | + } else { |
| 199 | + debug("Failed to get fetch cache", e); |
| 200 | + } |
196 | 201 | return null; |
197 | 202 | } |
198 | 203 | } |
@@ -271,7 +276,11 @@ export default class S3Cache { |
271 | 276 | return null; |
272 | 277 | } catch (e) { |
273 | 278 | // We can usually ignore errors here as they are usually due to cache not being found |
274 | | - debug("Failed to get body cache", e); |
| 279 | + if (isIgnorableError(e)) { |
| 280 | + debug("Failed to get body cache", e.message); |
| 281 | + } else { |
| 282 | + debug("Failed to get body cache", e); |
| 283 | + } |
275 | 284 | return null; |
276 | 285 | } |
277 | 286 | } |
@@ -409,7 +418,11 @@ export default class S3Cache { |
409 | 418 | } |
410 | 419 | debug("Finished setting cache"); |
411 | 420 | } catch (e) { |
412 | | - error("Failed to set cache", e); |
| 421 | + if (isIgnorableError(e)) { |
| 422 | + debug("Failed to set cache", e.message); |
| 423 | + } else { |
| 424 | + error("Failed to set cache", e); |
| 425 | + } |
413 | 426 | } finally { |
414 | 427 | // We need to resolve the promise even if there was an error |
415 | 428 | detachedPromise?.resolve(); |
@@ -456,7 +469,11 @@ export default class S3Cache { |
456 | 469 | await globalThis.tagCache.writeTags(toInsert); |
457 | 470 | } |
458 | 471 | } catch (e) { |
459 | | - error("Failed to revalidate tag", e); |
| 472 | + if (isIgnorableError(e)) { |
| 473 | + debug("Failed to revalidate tag", e.message); |
| 474 | + } else { |
| 475 | + error("Failed to revalidate tag", e); |
| 476 | + } |
460 | 477 | } |
461 | 478 | } |
462 | 479 | } |
0 commit comments