diff --git a/deno.json b/deno.json index b9d7bbf2a..13807b715 100644 --- a/deno.json +++ b/deno.json @@ -9,7 +9,7 @@ "std/": "https://deno.land/std@0.204.0/", "partytown/": "https://deno.land/x/partytown@0.4.8/", "deco-sites/std/": "https://denopkg.com/deco-sites/std@1.22.11/", - "deco/": "https://denopkg.com/deco-cx/deco@1.47.4/" + "deco/": "https://denopkg.com/deco-cx/deco@1.47.5/" }, "lock": false, "tasks": { diff --git a/website/pages/Page.tsx b/website/pages/Page.tsx index 00d0d098a..1248d936e 100644 --- a/website/pages/Page.tsx +++ b/website/pages/Page.tsx @@ -45,9 +45,9 @@ export function renderSection(section: Props["sections"][number]) { return ; } -class ErrorBoundary - extends Component<{ fallback: ComponentFunc }> { - state = { error: null }; +class ErrorBoundary extends // deno-lint-ignore no-explicit-any +Component<{ fallback: ComponentFunc }> { + state = { error: null as Error | null }; // deno-lint-ignore no-explicit-any static getDerivedStateFromError(error: any) { @@ -56,7 +56,7 @@ class ErrorBoundary render() { if (this.state.error) { - const err = this?.state?.error as Error; + const err = this?.state?.error; const msg = `rendering: ${this.props} ${err?.stack}`; logger.error( msg, @@ -65,9 +65,11 @@ class ErrorBoundary msg, ); } - return this.state.error - ? this.props.fallback(this.state.error) - : this.props.children; + return !this.state.error || + (this.state.error instanceof HttpError && + (this.state.error as HttpError).status < 400) + ? this.props.children + : this.props.fallback(this.state.error); } }