Skip to content

Commit

Permalink
Wrap one of the errors.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705185321
  • Loading branch information
CertoToStore Team authored and copybara-github committed Dec 11, 2024
1 parent 62dfe49 commit 683c674
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sysinfo_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

// Copyright 2017 Google Inc.
Expand Down Expand Up @@ -25,6 +26,11 @@ import (
"github.com/StackExchange/wmi"
)

var (
// ErrNoNetworkAdapter is returned when no network adapter is detected.
ErrNoNetworkAdapter = errors.New("network adapter not detected")
)

// User will obtain the current user from the OS.
func User() (string, error) {
if u := os.Getenv("USERNAME"); u != "" {
Expand Down Expand Up @@ -109,7 +115,7 @@ func NetInfo() ([]string, error) {
}

if len(netInfo) == 0 {
return nil, fmt.Errorf("network adapter not detected. got: %d want: >= 1", len(netInfo))
return nil, fmt.Errorf("%w got: %d want: >= 1", ErrNoNetworkAdapter, len(netInfo))
}

var macs []string
Expand Down

0 comments on commit 683c674

Please sign in to comment.