fix(wireguard): propagate wg-quick errors instead of swallowing them#80
Open
Sentinel-Bluebuilder wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
connect()anddisconnect()now returnPromise<void>instead ofvoid, allowing callers toawaitthem and catch failures.errorevent on the spawned process (e.g. whenwg-quickis not found) and rejects with a descriptive message.Motivation
Previously, if
wg-quick uporwg-quick downfailed (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
connect()without root/sudo privileges and verify the returned Promise rejects with exit code and stderrconnect()with a valid config as root and verify the Promise resolvesdisconnect()on a non-existent interface and verify rejection with stderr detailsawait connect()/await disconnect()work correctly in async callers🤖 Generated with Claude Code