[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: gracefully handle docs failures (#502)

authored by

James Garbutt and committed by
GitHub
d9fb143b 27653f9c

+10 -5
+10 -5
server/utils/docs/client.ts
··· 7 7 * @module server/utils/docs/client 8 8 */ 9 9 10 - import { doc } from '@deno/doc' 10 + import { doc, type DocNode } from '@deno/doc' 11 11 import type { DenoDocNode, DenoDocResult } from '#shared/types/deno-doc' 12 12 13 13 // ============================================================================= ··· 33 33 } 34 34 35 35 // Generate docs using @deno/doc WASM 36 - const result = await doc([typesUrl], { 37 - load: createLoader(), 38 - resolve: createResolver(), 39 - }) 36 + let result: Record<string, DocNode[]> 37 + try { 38 + result = await doc([typesUrl], { 39 + load: createLoader(), 40 + resolve: createResolver(), 41 + }) 42 + } catch { 43 + return { version: 1, nodes: [] } 44 + } 40 45 41 46 // Collect all nodes from all specifiers 42 47 const allNodes: DenoDocNode[] = []