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

raise type error for bad adapter circuit conversion input type #137

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

ryanhill1
Copy link
Contributor

Summary

More descriptive error message for bad conversion function input.

Before:

from qiskit_braket_provider.providers.adapter import convert_qiskit_to_braket_circuit

convert_qiskit_to_braket_circuit("abc")
# AttributeError: 'Circuit' object has no attribute 'data'
from unittest.mock import Mock

bad_input = Mock()
bad_input.data = []

convert_qiskit_to_braket_circuit(fake)
# TypeError: '>' not supported between instances of 'Mock' and 'float'

etc.

Now:

convert_qiskit_to_braket_circuit(input)
# TypeError: 'Expected a qiskit.QuantumCircuit, got <type(input)> instead'

@jcjaskula-aws
Copy link
Collaborator

jcjaskula-aws commented Jan 16, 2024

Hello @ryanhill1 , I'm considering changing the API in another PR, and it looks going in the same direction. I cannot guarantee to merge it fast so I'd be fine to merge this first.

@jcjaskula-aws jcjaskula-aws merged commit 5664916 into qiskit-community:main Jan 29, 2024
8 checks passed
@ryanhill1 ryanhill1 deleted the rh1-input-type-check branch February 1, 2024 19:21
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