Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error logging in tailscale #7776

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Conversation

manuelbuil
Copy link
Contributor

Proposed Changes

Return the output of the command instead of the error. Error will say nothing useful, just "exit 1/2", whereas the output (which is cmd.Stderr) will provide more useful information

Types of Changes

Bugfix

Verification

Start VPN with a wrong joinKey. Now you should see a useful error saying:

invalid key: unable to validate API key

Before, you'd only see exit 1

Testing

Linked Issues

#7771

User-Facing Change


Further Comments

@manuelbuil manuelbuil requested a review from a team as a code owner June 14, 2023 09:31
@manuelbuil manuelbuil changed the title Fix the error report Fix error logging in tailscale Jun 14, 2023
@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Patch coverage has no change and project coverage change: +27.20 🎉

Comparison is base (55db9b1) 19.85% compared to head (d0674a7) 47.05%.

❗ Current head d0674a7 differs from pull request most recent head 632fb37. Consider uploading reports for the commit 632fb37 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #7776       +/-   ##
===========================================
+ Coverage   19.85%   47.05%   +27.20%     
===========================================
  Files          83      143       +60     
  Lines        7686    13211     +5525     
===========================================
+ Hits         1526     6217     +4691     
+ Misses       5930     5899       -31     
- Partials      230     1095      +865     
Flag Coverage Δ
e2etests 49.41% <0.00%> (?)
unittests 19.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/vpn/vpn.go 0.00% <0.00%> (ø)

... and 117 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit on error message

pkg/vpn/vpn.go Outdated
if err != nil {
return err
return errors.New("Error while starting the VPN: " + output)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Errors should not be capitalized
  2. Maybe wrap the exec error instead of creating a new one?
Suggested change
return errors.New("Error while starting the VPN: " + output)
return errors.Wrap(err, "tailscale up failed: " + output)

Copy link
Contributor Author

@manuelbuil manuelbuil Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@manuelbuil manuelbuil force-pushed the fixErrorReport branch 2 times, most recently from 6057e49 to 632fb37 Compare June 14, 2023 14:55
Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm once ci is happy

Signed-off-by: Manuel Buil <[email protected]>
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.

3 participants