Files
Copilot 3ab3880de5 Show actionable network error instead of "Compiler returned: -1" on connectivity loss (#8676)
When the browser loses network connectivity mid-compilation, the output
pane showed `Compiler returned: -1` — implying a code/compiler problem
when the request never reached the backend. This is especially
disruptive in demo/presentation settings.

## Changes

**Network error detection (`static/compiler-service.ts`)**
- HTTP status `0` on an `error` textStatus → network failure (request
never left the browser)
- Message varies by `navigator.onLine`:
- Online: `"Could not reach Compiler Explorer. Check your internet
connection and try again."`
- Offline: `"Could not reach Compiler Explorer: your browser appears to
be offline."`
- Sets `isNetworkError = true` on the rejected `Error`

**New `networkError` flag
(`types/compilation/compilation.interfaces.ts`)**
- Added `networkError?: boolean` to `CompilationResult` to propagate the
transport-failure signal through the result pipeline

**Compiler pane (`static/panes/compiler.ts`)**
- `sendCompile` / `sendCMakeCompile` catch blocks: when
`isNetworkError`, build a result with `networkError: true` and the
message in both `asm` (assembly pane) and `stderr` (output pane); stack
trace is not logged (expected, not a bug)

**Executor pane (`static/panes/executor.ts`)**
- Same `isNetworkError` detection in catch blocks
- `handleCompileRequestAndResponse`: suppresses "Could not execute the
program" and "Compiler returned: X" when `networkError` is true — only
the descriptive network message is shown

**Output pane (`static/panes/output.ts`)**
- Skips the `Compiler returned: N` line entirely when
`result.networkError` is true; the error message surfaced via
`result.stderr` is shown instead

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `download.cypress.io`
> - Triggering command: `/usr/local/bin/node node dist/index.js --exec
install` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/compiler-explorer/compiler-explorer/settings/copilot/coding_agent)
(admins only)
>
> </details>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattgodbolt <633973+mattgodbolt@users.noreply.github.com>
2026-05-06 10:18:02 -04:00
..
2025-10-28 09:45:26 +01:00
2025-06-18 09:04:23 -05:00
2025-07-28 10:34:46 -05:00
2025-04-24 12:10:37 -05:00
2025-07-28 10:34:46 -05:00