From 66dcaf850f894438e1cc96d986a6bb7eb5660cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Mon, 18 Mar 2024 11:08:49 +0000 Subject: [PATCH] Ignore all errors for rendering integration blocks (#293) --- .../DocumentView/Integration/IntegrationBlock.tsx | 1 + src/lib/api.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/DocumentView/Integration/IntegrationBlock.tsx b/src/components/DocumentView/Integration/IntegrationBlock.tsx index 41f985f52..6eb91d1e9 100644 --- a/src/components/DocumentView/Integration/IntegrationBlock.tsx +++ b/src/components/DocumentView/Integration/IntegrationBlock.tsx @@ -74,6 +74,7 @@ export async function IntegrationBlock(props: BlockProps(promise: Promise): Promise { +export async function ignoreAPIError( + promise: Promise, + ignoreAll: boolean = false, +): Promise { try { return await promise; } catch (error) { const code = (error as GitBookAPIError).code; - if (code >= 400 && code < 500) { + if (ignoreAll || (code >= 400 && code < 500)) { return null; }