qiskit-community / qiskit-braket-provider

Qiskit-Braket provider to execute Qiskit programs on quantum computing hardware devices through Amazon Braket.
https://qiskit-community.github.io/qiskit-braket-provider/
Apache License 2.0
58 stars 45 forks source link

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

Closed ryanhill1 closed 8 months ago

ryanhill1 commented 8 months ago

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 commented 8 months ago

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.