* Announce a failed /api call before it is thrown (provider/error-observer.ts), * so the frontend log holds it even though the panel catches it and shows a * sentence instead. A 4xx is the server saying no to this request (warn); * no answer, a 5xx or an unreadable body is a failure (error).
(error: AtlasApiError, detail?: string)
| 83 | * no answer, a 5xx or an unreadable body is a failure (error). |
| 84 | */ |
| 85 | function announce(error: AtlasApiError, detail?: string): AtlasApiError { |
| 86 | if (hasErrorObservers()) { |
| 87 | const refused = error.status >= 400 && error.status < 500; |
| 88 | reportError({ |
| 89 | source: 'api', |
| 90 | project: new URL(error.route, 'http://127.0.0.1').searchParams.get('project') ?? '', |
| 91 | level: refused ? 'warn' : 'error', |
| 92 | message: error.message, |
| 93 | detail, |
| 94 | }); |
| 95 | } |
| 96 | return error; |
| 97 | } |
| 98 | |
| 99 | const text = (value: unknown): string => (typeof value === 'string' ? value : ''); |
| 100 |
no test coverage detected