Skip to content

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

Open
Shadow53 wants to merge 7 commits intomainfrom
427-better-errors
Open

fix(lib)!: clean up Error type variants, prefer error objects to strings#431
Shadow53 wants to merge 7 commits intomainfrom
427-better-errors

Conversation

@Shadow53
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown

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

/// 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
Copy Markdown
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