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: Add error message for running a circuit without instructions #161

Merged
merged 3 commits into from
Oct 2, 2020

Conversation

avawang1
Copy link
Contributor

@avawang1 avawang1 commented Oct 1, 2020

Issue #, if available:

Description of changes:

  • Add error message for running a circuit without instructions. Before, for circuits without any gates (only observables, for example), an uninformative validation error is returned: "max() arg is an empty sequence"

Testing done:

  • Added unit tests

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@amazon-braket-ci-bot
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: SDKPullRequestBuild
  • Commit ID: 25f1258
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Comment on lines +26 to +28
ValueError: If circuit has no instructions. Also, if no result types
specified for circuit and `shots=0`. See `braket.circuit.result_types`.
Or, if `StateVector` or `Amplitude` are specified as result types when `shots > 0`.
Copy link
Member

Choose a reason for hiding this comment

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

Is the check for Sample with shots=0 done somewhere else? I forgot. If it is, does it make sense to move it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's already a check for that in the default simulator and API. I don't think we need to add a duplicate check here.

@amazon-braket-ci-bot
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: SDKPullRequestBuild
  • Commit ID: 375ffe8
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@avawang1 avawang1 merged commit 2d0f862 into main Oct 2, 2020
@avawang1 avawang1 deleted the error_message branch October 2, 2020 16:22
kshitijc pushed a commit that referenced this pull request Nov 29, 2021
fix: better exception handling for aws device
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.

3 participants