Add new transpiler exception class for too many qubits#11241
Conversation
This commit adds a new exception class for when the transpiler is given a circuit too many qubits for a given backend. Previously the generic TranspilerError was raised for this, but it made it difficult for downstream users to catch as it wasn't easy to differentiate this error condition from other TranspilerError exceptions. There isn't any backwards compatibility issues with this because the new CircuitToWideForTarget class is a subclass of TranspilerError so any of the previous catches for TranspilerError will still catch this.
|
One or more of the the following people are requested to review this:
|
jakelishman
left a comment
There was a problem hiding this comment.
This seems like a generally sensible option. Would ApplyLayout and SetLayout potentially raise this as well?
Pull Request Test Coverage Report for Build 6869462528Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
It turns out the answer is no because neither |
|
Yeah that sounds all good to me - if there's nothing else that should raise it, I'm happy this PR is complete from the feature side. Do you want to enforce the new type of the exception in the |
I adjusted the existing test to catch the more specific error in: 15af4e2 |
Summary
This commit adds a new exception class for when the transpiler is given a circuit too many qubits for a given backend. Previously the generic TranspilerError was raised for this, but it made it difficult for downstream users to catch as it wasn't easy to differentiate this error condition from other TranspilerError exceptions. There isn't any backwards compatibility issues with this because the new CircuitToWideForTarget class is a subclass of TranspilerError so any of the previous catches for TranspilerError will still catch this.
Details and comments