Closed S-Linde closed 1 month ago
Hi Stan,
I've added some final comments:
- Keep Error clases to store only error messages.
- Just reuse those error messages, without duplicating any other text (e.g. when creating an ExportError).
- Rename ExportError to QuantifySchedulerExporterError.
- Error messages should start in lowercase, and not end in any kind of punctuation. That makes them suitable for inserting in other error messages. This is probably more debatable, but it is the way I'm used to work in C++, and the standard for Rust as well, although may not be the case in Python.
Anyway, think of the ExportError case: you put the UnsupportedGateError in the middle of another message (which is something very common). So you can end up with:
Cannot export circuit: The gate is not supported...
, orCannot export circuit: the gate is not supported...
.And that should apply to whoever catches an ExportError too:
Error: Cannot export...
, orError: cannot export...
.
Thank you for the detailed explanation. The error message of UnsuportedGateError
is now reused and it starts with a lower case and has no punctuation at the end.
This merge request fixes incorrect error handling. No bare exceptions are raised anywhere in the code. Furthermore, all
assert
statements are removed except those in the test folders and thecheck_passes
subpackage.Closes #125