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: More deep error messages #159

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

fix: More deep error messages #159

wants to merge 12 commits into from

Conversation

TeaDove
Copy link

@TeaDove TeaDove commented Aug 17, 2024

Without proposed changes, errors on start are very hard to debug.

For example, if i start app with
spoof-dpi -system-proxy=true -debug
I will get:
image

But with given changes error message is less difficult to understand
image

(whole problem was with no admin privileges)

@TeaDove
Copy link
Author

TeaDove commented Aug 20, 2024

(if pkg/errors is too big to include in project, i can rewrite code using std errors.Joins)

@xvzc
Copy link
Owner

xvzc commented Aug 21, 2024

Can't it be done with fmt.Errorf()?

@TeaDove
Copy link
Author

TeaDove commented Aug 21, 2024

@xvzc you are right! ty. I've rewrited code using fmt.Errorf

util/os.go Outdated
@@ -19,18 +19,16 @@ func SetOsProxy(port int) error {

network, err := getDefaultNetwork()
if err != nil {
return fmt.Errorf("failed to get network interfaces, stdout: %s: %w", string(network), err)
return fmt.Errorf("failed to get network interfaces: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it should be network or network service. We extract an interface from the route command and try to find a NS that uses it.

Copy link
Author

@TeaDove TeaDove Aug 22, 2024

Choose a reason for hiding this comment

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

I rewrote it as failed to get default network, cause we are calling getDefaultNetwork.

@xvzc xvzc changed the title ref: More deep error messages fix: More deep error messages Aug 27, 2024
@xvzc xvzc added the fix label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants