(text: string, args: readonly string[])
| 1 | import { summarizeGhArgs } from "./github-retry.js"; |
| 2 | |
| 3 | export function parseGhJson<T>(text: string, args: readonly string[]): T { |
| 4 | try { |
| 5 | return JSON.parse(text) as T; |
| 6 | } catch (error) { |
| 7 | throw new Error( |
| 8 | `Failed to parse JSON from ${summarizeGhArgs(args)}: ${formatParseError(error)}`, |
| 9 | ); |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | export function parseGhJsonLines<T>(text: string, args: readonly string[]): T[] { |
| 14 | if (!text) return []; |
no test coverage detected