-
Notifications
You must be signed in to change notification settings - Fork 51
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
hiffy: differentiate dead codes from error codes #472
Conversation
When invoking an IPC using `humility-hiffy`, the result is represented as a `u32`. Calling code typically will then attempt to turn that `u32` back into the IPC interface's error code. However, if the server task that Hiffy called into has died, the `u32` will instead be a dead code, which cannot be translated into a named error code using the Idol interface (or similar). Therefore, this branch updates `humility hiffy` to return an `IpcError` enum instead, which is either an error code or a dead code. This forces callers to differentiate between these cases, and not print out random integers when the server task has died.
4a5a42b
to
9196449
Compare
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.
Looks good -- please bump the micro version as well!
@@ -2274,12 +2274,13 @@ fn rendmp(context: &mut ExecutionContext) -> Result<()> { | |||
} | |||
}; | |||
|
|||
let word_result = |result: &Result<Vec<u8>, u32>, what| -> Result<u32> { | |||
let word_result = |result: &Result<Vec<u8>, IpcError>, | |||
what| |
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.
...are you okay, rustfmt
?
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.
what|
979f12b
to
0d9c753
Compare
When invoking an IPC using
humility-hiffy
, the result is represented as au32
. Calling code typically will then attempt to turn thatu32
back into the IPC interface's error code. However, if the server task that Hiffy called into has died, theu32
will instead be a dead code, which cannot be translated into a named error code using the Idol interface (or similar). Therefore, this branch updateshumility hiffy
to return anIpcError
enum instead, which is either an error code or a dead code. This forces callers to differentiate between these cases, and not print out random integers when the server task has died.