Skip to content
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

Add RFC for improving client error ergonomics #2075

Merged
merged 7 commits into from
Apr 5, 2024

Conversation

jdisanti
Copy link
Collaborator

@jdisanti jdisanti commented Dec 8, 2022

Motivation and Context

This RFC proposes merging Error/ErrorKind on code generated client errors to simplify error handling.

Rendered


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

design/src/rfcs/rfc0026_improve_client_error_ergonomics.md Outdated Show resolved Hide resolved
design/src/rfcs/rfc0026_improve_client_error_ergonomics.md Outdated Show resolved Hide resolved
design/src/rfcs/rfc0026_improve_client_error_ergonomics.md Outdated Show resolved Hide resolved
Comment on lines 78 to 87
Err(err) => match err.into_service_error() {
GetObjectError::InvalidObjectState(value) => {
println!("invalid object state: {:?}", value);
}
err if err.is_no_such_key() => {
println!("object didn't exist");
}
err if err.code() == Some("SomeUnmodeledError") => {}
err @ _ => return Err(err.into()),
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a great UX! I'd enjoy interacting with this.

design/src/rfcs/rfc0026_improve_client_error_ergonomics.md Outdated Show resolved Hide resolved
jdisanti and others added 4 commits December 8, 2022 14:49
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@jdisanti
Copy link
Collaborator Author

Need to incorporate feedback from awslabs/aws-sdk-rust#693

@raunakdoesdev
Copy link

Any updates on this? Making your errors compatible with Tauri (making them serializable) has been an absolute nightmare given the multiple conversion steps I need to run...

@jdisanti
Copy link
Collaborator Author

jdisanti commented Apr 5, 2024

This RFC was implemented a long time ago, but I never got around to incorporating the feedback from awslabs/aws-sdk-rust#693. At this point, I want to get this merged just so that it's in the designs folder rather than in an ancient unmerged PR.

Any updates on this? Making your errors compatible with Tauri (making them serializable) has been an absolute nightmare given the multiple conversion steps I need to run...

Sorry I didn't see this sooner. I need to understand your use-case better. Feel free to file an issue. My gut feel though is that you shouldn't need to serialize these errors for the UI, besides maybe converting them into a user-friendly error message.

@jdisanti jdisanti marked this pull request as ready for review April 5, 2024 22:14
@jdisanti jdisanti requested review from a team as code owners April 5, 2024 22:14
Copy link

github-actions bot commented Apr 5, 2024

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

github-actions bot commented Apr 5, 2024

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@jdisanti jdisanti merged commit c6020e6 into main Apr 5, 2024
40 of 42 checks passed
@jdisanti jdisanti deleted the jdisanti-rfc-improve-error-ergonomics branch April 5, 2024 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client rfc Marks a PR as an RFC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants