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 up powersupplyclass error #1749

Merged
merged 1 commit into from
Jun 15, 2020
Merged

Conversation

SuperQ
Copy link
Member

@SuperQ SuperQ commented Jun 15, 2020

  • Remove internal wrapping of PowerSupplyClass error.
  • Switch to errors.Is().

Signed-off-by: Ben Kochie [email protected]

@SuperQ SuperQ requested a review from roidelapluie June 15, 2020 06:03
@SuperQ
Copy link
Member Author

SuperQ commented Jun 15, 2020

This isn't it either. The problem is, this function returns the error from ioutil.ReadDir(), which is returning this from os.Open().

open /sys/class/power_supply: no such file or directory

This appears to be a raw syscall error, and not something defined as a Go error.

@SuperQ SuperQ force-pushed the bjk/powersupplyclass_invalid branch from c639cc8 to 5e29cea Compare June 15, 2020 06:31
@roidelapluie
Copy link
Member

It is a PathError then

@roidelapluie
Copy link
Member

It is a path error with a Unwrap error so that error.is could work

@roidelapluie
Copy link
Member

Please remove wrapping at L190 and use os.IsNotExist

@SuperQ SuperQ force-pushed the bjk/powersupplyclass_invalid branch from 5e29cea to aa0cc29 Compare June 15, 2020 07:27
Switch to go `%w` error verb and errors.Is().

Signed-off-by: Ben Kochie <[email protected]>
@SuperQ SuperQ force-pushed the bjk/powersupplyclass_invalid branch from aa0cc29 to 39c6174 Compare June 15, 2020 07:32
@discordianfish discordianfish merged commit 64ba27e into master Jun 15, 2020
@discordianfish discordianfish deleted the bjk/powersupplyclass_invalid branch June 15, 2020 10:36
@SuperQ SuperQ mentioned this pull request Jun 15, 2020
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