Skip to content

Commit df98508

Browse files
authored
Clarify rzz out of range error message (#2276)
Some users reported that the "has been provided" wording sounded like the backend was providing that angle rather than it having been included in the circuit submitted by the user so here "provided" is changed to "requested" to make it more clear that it was the user's request that led to the error.
1 parent 411dadd commit df98508

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

qiskit_ibm_runtime/utils/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _is_isa_circuit_helper(circuit: QuantumCircuit, target: Target, qubit_map: D
8484
):
8585
return (
8686
f"The instruction {name} on qubits {qargs} is supported only for angles in the "
87-
f"range [0, pi/2], but an angle of {param} has been provided."
87+
f"range [0, pi/2], but an angle ({param}) outside of this range has been requested."
8888
)
8989

9090
if isinstance(operation, ControlFlowOp):
@@ -151,7 +151,8 @@ def _is_valid_rzz_pub_helper(circuit: QuantumCircuit) -> Union[str, Set[Paramete
151151
elif angle < 0.0 or angle > np.pi / 2 + 1e-10:
152152
return (
153153
"The instruction rzz is supported only for angles in the "
154-
f"range [0, pi/2], but an angle of {angle} has been provided."
154+
f"range [0, pi/2], but an angle ({angle}) outside of this "
155+
"range has been requested."
155156
)
156157

157158
if isinstance(operation, ControlFlowOp):
@@ -207,9 +208,9 @@ def is_valid_rzz_pub(pub: Union[EstimatorPub, SamplerPub]) -> str:
207208
)
208209
return (
209210
"The instruction rzz is supported only for angles in the "
210-
f"range [0, pi/2], but an angle of {angle} has been provided; "
211-
f"via parameter value(s) {vals_msg}, substituted in parameter expression "
212-
f"{param_exp}."
211+
f"range [0, pi/2], but an angle ({angle}) outside of this range has been "
212+
f"requested; via parameter value(s) {vals_msg}, substituted in parameter "
213+
f"expression {param_exp}."
213214
)
214215

215216
return ""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Error messages related to ``rzz`` gate angles being outside of the allowed
2+
range of 0 to :math:`\pi/2` during circuit validation have been updated to
3+
clarify that the angle value requested in the circuit was the problem and not
4+
an angle value provided by the backend.

0 commit comments

Comments
 (0)