-
Notifications
You must be signed in to change notification settings - Fork 105
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
Error Handling in 0.8 #1139
Comments
jswrenn
added a commit
that referenced
this issue
May 2, 2024
This PR overhauls error reporting, replacing our `Option` returns with `Result`s. The `Err` type of these results provide both the cause of the failure, and access to the underlying source of the conversion. Makes progress towards #1139.
jswrenn
added a commit
that referenced
this issue
May 2, 2024
This PR overhauls error reporting, replacing our `Option` returns with `Result`s. The `Err` type of these results provide both the cause of the failure, and access to the underlying source of the conversion. Makes progress towards #1139.
jswrenn
added a commit
that referenced
this issue
May 2, 2024
This PR overhauls error reporting, replacing our `Option` returns with `Result`s. The `Err` type of these results provide both the cause of the failure, and access to the underlying source of the conversion. Makes progress towards #1139.
jswrenn
added a commit
that referenced
this issue
May 3, 2024
This PR overhauls error reporting, replacing our `Option` returns with `Result`s. The `Err` type of these results provide both the cause of the failure, and access to the underlying source of the conversion. Makes progress towards #1139.
jswrenn
added a commit
that referenced
this issue
May 3, 2024
This PR overhauls error reporting, replacing our `Option` returns with `Result`s. The `Err` type of these results provide both the cause of the failure, and access to the underlying source of the conversion. Makes progress towards #1139.
github-merge-queue bot
pushed a commit
that referenced
this issue
May 3, 2024
This PR overhauls error reporting, replacing our `Option` returns with `Result`s. The `Err` type of these results provide both the cause of the failure, and access to the underlying source of the conversion. Makes progress towards #1139.
jswrenn
added a commit
that referenced
this issue
May 6, 2024
This make's `Unalign`'s methods consistent with zerocopy's other methods, and, in the case of `Unalign::try_deref_mut`, allows the original `&mut Unalign<T>` to be reused in the event of failure. Makes progress towards #1139
jswrenn
added a commit
that referenced
this issue
May 6, 2024
This make's `Unalign`'s methods consistent with zerocopy's other methods, and, in the case of `Unalign::try_deref_mut`, allows the original `&mut Unalign<T>` to be reused in the event of failure. Makes progress towards #1139
jswrenn
added a commit
that referenced
this issue
May 6, 2024
This make's `Unalign`'s methods consistent with zerocopy's other methods, and, in the case of `Unalign::try_deref_mut`, allows the original `&mut Unalign<T>` to be reused in the event of failure. Makes progress towards #1139
github-merge-queue bot
pushed a commit
that referenced
this issue
May 6, 2024
This make's `Unalign`'s methods consistent with zerocopy's other methods, and, in the case of `Unalign::try_deref_mut`, allows the original `&mut Unalign<T>` to be reused in the event of failure. Makes progress towards #1139
jswrenn
added a commit
that referenced
this issue
May 17, 2024
This permits matching on the error variant, and ensures that the variants are rendered in rustdoc. Makes progress on #1139.
jswrenn
added a commit
that referenced
this issue
May 17, 2024
This permits matching on the error variant, and ensures that the variants are rendered in rustdoc. Makes progress on #1139.
jswrenn
added a commit
that referenced
this issue
May 17, 2024
This permits matching on the error variant, and ensures that the variants are rendered in rustdoc. Makes progress on #1139.
github-merge-queue bot
pushed a commit
that referenced
this issue
May 17, 2024
This permits matching on the error variant, and ensures that the variants are rendered in rustdoc. Makes progress on #1139.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
Zerocopy's deserialization methods will return
Result
instead ofOption
. TheErr
type of theResult
will provide:Motivation
Providing better error messages
As it stands,
.unwrap()
presently produces an uninformative error message. Using a custom error type will allow us to provide precise diagnostic text.Providing programatic access to the cause of the failure
The bytemuck crate provides this information with its
PodCastError
type. A cursory search of Github suggests that this fidelity is useful to some customers.Providing the original bytes
Our current API does not always provide access to the original bytes in the case of deserialization failure. For instance, attempting this:
...produces this error message:
Steps
Unalign
's methods returnResult<_, AlignmentError<_, _>>
AlignmentError
inUnalign
's failure conditions #1198ConvertError
public, orThe text was updated successfully, but these errors were encountered: