Skip to content

fix(wireguard): propagate wg-quick errors instead of swallowing them#80

Open
Sentinel-Bluebuilder wants to merge 1 commit into
sentinel-official:developmentfrom
Sentinel-Bluebuilder:fix/wireguard-error-handling
Open

fix(wireguard): propagate wg-quick errors instead of swallowing them#80
Sentinel-Bluebuilder wants to merge 1 commit into
sentinel-official:developmentfrom
Sentinel-Bluebuilder:fix/wireguard-error-handling

Conversation

@Sentinel-Bluebuilder

Copy link
Copy Markdown

Summary

  • connect() and disconnect() now return Promise<void> instead of void, allowing callers to await them and catch failures.
  • Collects stderr output and includes it in rejection error messages along with the exit code.
  • Listens for the error event on the spawned process (e.g. when wg-quick is not found) and rejects with a descriptive message.
  • Removes stale comments and console-only logging that silently swallowed failures.

Motivation

Previously, if wg-quick up or wg-quick down failed (wrong permissions, missing binary, bad config), the error was logged to console and discarded. Callers had no way to detect or react to tunnel failures. This is especially problematic for automated/daemon use cases where silent failures lead to traffic leaking outside the tunnel.

Fixes #39

Test plan

  • Call connect() without root/sudo privileges and verify the returned Promise rejects with exit code and stderr
  • Call connect() with a valid config as root and verify the Promise resolves
  • Call disconnect() on a non-existent interface and verify rejection with stderr details
  • Verify await connect() / await disconnect() work correctly in async callers

🤖 Generated with Claude Code

connect() and disconnect() spawned wg-quick but only logged errors to
console without propagating them. Callers had no way to know if the
tunnel actually started. Now returns Promises that reject with
descriptive error messages including stderr output and exit codes.

Fixes sentinel-official#39

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Sentinel-Bluebuilder Sentinel-Bluebuilder changed the base branch from main to development April 24, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: WireGuard wg-quick spawn errors silently swallowed

1 participant