Skip to content

Comments

Fix up powersupplyclass error#1749

Merged
discordianfish merged 1 commit intomasterfrom
bjk/powersupplyclass_invalid
Jun 15, 2020
Merged

Fix up powersupplyclass error#1749
discordianfish merged 1 commit intomasterfrom
bjk/powersupplyclass_invalid

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 superq@gmail.com

@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 <superq@gmail.com>
@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