-
Notifications
You must be signed in to change notification settings - Fork 330
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
Use errors.Is() for invalid argument #483
Conversation
Switch to using Go errors.Is() to check for the "invalid argument" error. Signed-off-by: SuperQ <superq@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@SuperQ @discordianfish turns out this PR now prematurely terminates parsing on at least some systems (RHEL, Fedora) because the "invalid argument" error is actually a Should I do a patch with a function that checks errors.Is(err, syscall.Errno) and compares to EINVAL, or should we revert? |
prometheus#483 introduced a bug that terminates attribute reading when the returned error is syscall.Errno, which is what util.SysReadFile() will typically return. Handle that case specifically. While doing that pull the error checking into ParseNetClassAttribute() for clarity and to allow external callers to handle errors correctly. Signed-off-by: Dan Williams <dcbw@redhat.com>
prometheus#483 introduced a bug that terminates attribute reading when the returned error is syscall.Errno, which is what util.SysReadFile() will typically return. Handle that case specifically. While doing that pull the error checking into ParseNetClassAttribute() for clarity and to allow external callers to handle errors correctly. Signed-off-by: Dan Williams <dcbw@redhat.com>
prometheus#483 introduced a bug that terminates attribute reading when the returned error is syscall.Errno, which is what util.SysReadFile() will typically return. Handle that case specifically. While doing that pull the error checking into ParseNetClassAttribute() for clarity and to allow external callers to handle errors correctly. Signed-off-by: Dan Williams <dcbw@redhat.com>
prometheus#483 introduced a bug that terminates attribute reading when the returned error is syscall.Errno, which is what util.SysReadFile() will typically return. Handle that case specifically. While doing that pull the error checking into ParseNetClassAttribute() for clarity and to allow external callers to handle errors correctly. Signed-off-by: Dan Williams <dcbw@redhat.com>
#483 introduced a bug that terminates attribute reading when the returned error is syscall.Errno, which is what util.SysReadFile() will typically return. Handle that case specifically. While doing that pull the error checking into ParseNetClassAttribute() for clarity and to allow external callers to handle errors correctly. Signed-off-by: Dan Williams <dcbw@redhat.com>
prometheus#483 introduced a bug that terminates attribute reading when the returned error is syscall.Errno, which is what util.SysReadFile() will typically return. Handle that case specifically. While doing that pull the error checking into ParseNetClassAttribute() for clarity and to allow external callers to handle errors correctly. Signed-off-by: Dan Williams <dcbw@redhat.com>
Switch to using Go errors.Is() to check for the "invalid argument" error.
Signed-off-by: SuperQ superq@gmail.com