From 3de131786f6b343c0e548e970bb59ea0ac0c13e0 Mon Sep 17 00:00:00 2001 From: Matthew Herbst Date: Sat, 28 Sep 2024 15:17:36 -0700 Subject: [PATCH] Display original error when css fails to load (#740) --- src/utils/handlePrintWindowOnLoad.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/handlePrintWindowOnLoad.ts b/src/utils/handlePrintWindowOnLoad.ts index 04b4f1b..69ade0a 100644 --- a/src/utils/handlePrintWindowOnLoad.ts +++ b/src/utils/handlePrintWindowOnLoad.ts @@ -212,6 +212,7 @@ export function handlePrintWindowOnLoad( messages: [ `A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross \`crossorigin\` attribute, and setting the \`Access-Control-Allow-Origin\` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.`, // eslint-disable-line max-len node, + `Original error: ${(error as Error)?.message}`, ], level: 'warning', });