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

MS gate validation error handling #115

Open
ryanhill1 opened this issue Dec 18, 2024 · 0 comments
Open

MS gate validation error handling #115

ryanhill1 opened this issue Dec 18, 2024 · 0 comments
Labels
enhancement New feature or request error-handling Issues related to error handing and error propagation program-validation Issues related to program validation

Comments

@ryanhill1
Copy link
Member

This issue is very similar in nature to #109, and is indirectly related to #113.

The ms currently requires 3 parameters. If you instead provide it 2 parameters, there is an uncaught TypeError:

import pyqasm

qasm = """
OPENQASM 2;
include "qelib1.inc";
qreg q[2];

ms(0, 0.5) q[0], q[1];
"""

module = pyqasm.loads(qasm)

module.validate()
...
    [665] for targets in all_targets:
--> [666]     result.extend(gate_function(*targets))
    [667] return result

TypeError: ms_gate() missing 1 required positional argument: 'qubit1'

Instead, it should raise a ValidationError and tell you that the third parameter is missing.

@ryanhill1 ryanhill1 added program-validation Issues related to program validation error-handling Issues related to error handing and error propagation enhancement New feature or request labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request error-handling Issues related to error handing and error propagation program-validation Issues related to program validation
Projects
None yet
Development

No branches or pull requests

1 participant