-
Notifications
You must be signed in to change notification settings - Fork 190
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
Revamp errors in aws-smithy-checksums
#1850
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
cab8db6
to
61c63d0
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
6e3e165
to
1b90d4c
Compare
61c63d0
to
5fe1e7d
Compare
1b90d4c
to
ea102d4
Compare
5fe1e7d
to
6338f4c
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
ea102d4
to
b3a2b6c
Compare
6338f4c
to
e053f34
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
b3a2b6c
to
bd16b5d
Compare
e053f34
to
55c1535
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
cd90022
to
a15055e
Compare
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlock | ||
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType | ||
|
||
internal fun unhandledError(): RuntimeType = RuntimeType.forInlineFun("Unhandled", RustModule.Error) { |
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.
It might be more readable to do this in one rustTemplate
rather than chopping it up?
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.
Good call. Not sure why I didn't think of that 😅
@@ -397,7 +376,7 @@ mod tests { | |||
} | |||
|
|||
#[test] | |||
#[should_panic = "called `Result::unwrap()` on an `Err` value: UnknownChecksumAlgorithm(\"some invalid checksum algorithm\")"] | |||
#[should_panic = "called `Result::unwrap()` on an `Err` value: UnknownChecksumAlgorithmError { checksum_algorithm: \"some invalid checksum algorithm\" }"] |
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.
The reason we're should_panic
here rather than asserting on the error type is because we don't want to derive PartialEq
on the error?
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.
Would it be better to match on the error and then assert on the checksum_algorithm
?
a15055e
to
00fa06a
Compare
55c1535
to
104d2aa
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
104d2aa
to
6271b8c
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
This PR revamps errors in
aws-smithy-checksums
to adhere to RFC-0022: Error Context and Compatibility.This PR is part of a series that will fully implement the RFC, tracked in #1926.
Changelog entries added in #1951.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.