(body: string)
| 38 | * `exception`, so pick those out rather than modelling the whole format. |
| 39 | */ |
| 40 | const errorEventsIn = (body: string): ReadonlyArray<ReportedEvent> => |
| 41 | body |
| 42 | .split("\n") |
| 43 | .filter((line) => line.trim().startsWith("{")) |
| 44 | .flatMap((line) => { |
| 45 | try { |
| 46 | const parsed = JSON.parse(line) as ReportedEvent; |
| 47 | return parsed.exception ? [parsed] : []; |
| 48 | } catch { |
| 49 | return []; |
| 50 | } |
| 51 | }); |
| 52 | |
| 53 | scenario( |
| 54 | "Frontend errors · a failed API request is reported with a real message", |
no outgoing calls
no test coverage detected