Skip to content

Commit 4486fb2

Browse files
authored
Remove error wrapper from /sys/class/power_supply (#308)
Don't wrap the error of `ioutil.ReadDir()` so that the error return can be tested with `os.IsNotExist()`. Fixes node_exporter log noise. ``` caller=collector.go:161 msg="collector failed" name=powersupplyclass duration_seconds=0.00079848 err="could not get power_supply class info: error obtaining power_supply class info: failed to list power supplies at \"/sys/class/power_supply\": open /sys/class/power_supply: no such file or directory" ``` Signed-off-by: Ben Kochie <superq@gmail.com>
1 parent 9d2ce6b commit 4486fb2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sysfs/class_power_supply.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (fs FS) PowerSupplyClass() (PowerSupplyClass, error) {
110110

111111
dirs, err := ioutil.ReadDir(path)
112112
if err != nil {
113-
return nil, fmt.Errorf("failed to list power supplies at %q: %v", path, err)
113+
return nil, err
114114
}
115115

116116
psc := make(PowerSupplyClass, len(dirs))

0 commit comments

Comments
 (0)