Skip to content

Commit 552fd4f

Browse files
committed
More explicit error messages in qpy_compat
1 parent f7585e2 commit 552fd4f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

test/qpy_compat/test_qpy.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,13 @@ def load_qpy(qpy_files, version_parts):
11091109
# See https://github.com/Qiskit/qiskit/pull/13814
11101110
continue
11111111
print(f"Loading qpy file: {path}") # noqa: T201
1112-
with open(path, "rb") as fd:
1113-
qpy_circuits = load(fd)
1112+
try:
1113+
with open(path, "rb") as fd:
1114+
qpy_circuits = load(fd)
1115+
except Exception as ex:
1116+
msg = f"****QPY Load error****: Failed to load {path} with the exception: {ex}"
1117+
sys.stderr.write(msg)
1118+
sys.exit(1)
11141119
equivalent = path in {"open_controlled_gates.qpy", "controlled_gates.qpy"}
11151120
for i, circuit in enumerate(circuits):
11161121
bind = None

0 commit comments

Comments
 (0)