fix(cache): don't cache on failure error code

This commit is contained in:
Gergő Móricz 2024-11-14 19:49:34 +01:00
parent 49ff37afb4
commit 359c30fbda

View File

@ -3,6 +3,8 @@ import { Meta } from "..";
import { CacheEntry, cacheKey, saveEntryToCache } from "../../../lib/cache";
export function saveToCache(meta: Meta, document: Document): Document {
if (document.metadata.statusCode! < 200 || document.metadata.statusCode! >= 300) return document;
if (document.rawHtml === undefined) {
throw new Error("rawHtml is undefined -- this transformer is being called out of order");
}