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

fix(lib)!: clean up Error type variants, prefer error objects to strings #431

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Shadow53
Copy link
Contributor

Resolves #427. See #427 (comment) for why I did this instead of implementing retry logic.

There are a few main changes here, which all of which are API breaking:

  1. The QcsClient error variant on qpu::execution::Error was only used for translation errors, so it was renamed to better communicate that.
  2. The Translation variant on executable::Error was unused, so I changed the inner type to GrpcClientError from String and changed conversion so the above error variant becomes this one.
  3. I did a brief audit of the other variants on executable::Error using my editor's Find All References feature and deleted anything that had no references.
  • For variants decorated with #[from], I removed that decorator to see if anything broke due to implicit conversions no longer working. Only the variants where this did not introduce errors were deleted.

I'm open to restoring the unused variants and making them used, as appropriate. I figured that it would be good to clean things up while already making breaking changes.

Copy link

github-actions bot commented Jan 26, 2024

PR Preview Action v1.4.6
🚀 Deployed preview to https://rigetti.github.io/qcs-sdk-rust/pr-preview/pr-431/
on branch qcs-sdk-python-docs at 2024-01-26 22:06 UTC

@@ -643,29 +621,18 @@ pub enum Error {
Compilation(String),
/// There was a problem when translating the Quil program.
#[error("There was a problem translating the Quil program: {0}")]
Translation(String),
Translation(GrpcClientError),
Copy link
Contributor

Choose a reason for hiding this comment

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

Many of the other errors look to be handled within QpuApiError now, which also has it's own variant with the same type QpuApiError::GrpcClientError(#[from] GrpcClientError)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefer inspectable objects in errors over Strings
2 participants