-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
device: have IpcSetOperation not return typed error #7
Conversation
Update the golang.org/x/sys/unix dependency and use the newly introduced RTMGRP_* consts instead of using the corresponding RTNLGRP_* const to create a mask. Signed-off-by: Tobias Klauser <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
Signed-off-by: David Crawshaw <[email protected]>
status = device.IpcSetOperation(buffered.Reader) | ||
err := device.IpcSetOperation(buffered.Reader) | ||
if err != nil { | ||
status, _ = err.(*IPCError) |
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.
Isn't there a new Go 1.13 error API for this?
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.
There is. In 1.13 this could be:
if !errors.As(err, &status) {
device.log.Error.Println("Invalid UAPI error:", err)
status = &IPCError{1}
}
...
Shouldn't you be doing this to IpcGet as well as IpcSet? |
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.
I'll send a followup to make the same change to IpcGetOperation.
status = device.IpcSetOperation(buffered.Reader) | ||
err := device.IpcSetOperation(buffered.Reader) | ||
if err != nil { | ||
status, _ = err.(*IPCError) |
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.
There is. In 1.13 this could be:
if !errors.As(err, &status) {
device.log.Error.Println("Invalid UAPI error:", err)
status = &IPCError{1}
}
...
Closing in favor of #17. |
Signed-off-by: Jordan Whited <[email protected]>
Signed-off-by: Jordan Whited <[email protected]>
No description provided.