cda-tum / mqt-core

MQT Core - The Backbone of the Munich Quantum Toolkit
https://mqt.readthedocs.io/projects/core
MIT License
62 stars 31 forks source link

🚸 Better QASM parser exceptions #618

Closed burgholzer closed 5 months ago

burgholzer commented 5 months ago

Description

This PR augments the QASM parser exceptions with a proper overload of the std::exception::what() method so that they print proper error messages when raised. This came up in the light of https://github.com/cda-tum/mqt-ddvis/issues/259

Checklist:

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.6%. Comparing base (4121732) to head (8359a3c). Report is 104 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618/graphs/tree.svg?width=650&height=150&src=pr&token=MqstsRKdqp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum)](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) ```diff @@ Coverage Diff @@ ## main #618 +/- ## ===================================== Coverage 91.5% 91.6% ===================================== Files 147 147 Lines 14698 14702 +4 Branches 2359 2359 ===================================== + Hits 13461 13470 +9 + Misses 1237 1232 -5 ``` | [Flag](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | Coverage Δ | | |---|---|---| | [cpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | `91.3% <100.0%> (+<0.1%)` | :arrow_up: | | [python](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | `99.7% <ø> (ø)` | | | [Files with missing lines](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | Coverage Δ | | |---|---|---| | [...nclude/mqt-core/parsers/qasm3\_parser/Exception.hpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?src=pr&el=tree&filepath=include%2Fmqt-core%2Fparsers%2Fqasm3_parser%2FException.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-aW5jbHVkZS9tcXQtY29yZS9wYXJzZXJzL3Fhc20zX3BhcnNlci9FeGNlcHRpb24uaHBw) | `100.0% <100.0%> (+17.6%)` | :arrow_up: | | [include/mqt-core/parsers/qasm3\_parser/Parser.hpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?src=pr&el=tree&filepath=include%2Fmqt-core%2Fparsers%2Fqasm3_parser%2FParser.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-aW5jbHVkZS9tcXQtY29yZS9wYXJzZXJzL3Fhc20zX3BhcnNlci9QYXJzZXIuaHBw) | `92.8% <ø> (-0.3%)` | :arrow_down: | | [...core/parsers/qasm3\_parser/passes/ConstEvalPass.hpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?src=pr&el=tree&filepath=include%2Fmqt-core%2Fparsers%2Fqasm3_parser%2Fpasses%2FConstEvalPass.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-aW5jbHVkZS9tcXQtY29yZS9wYXJzZXJzL3Fhc20zX3BhcnNlci9wYXNzZXMvQ29uc3RFdmFsUGFzcy5ocHA=) | `80.9% <100.0%> (ø)` | | | [...core/parsers/qasm3\_parser/passes/TypeCheckPass.hpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?src=pr&el=tree&filepath=include%2Fmqt-core%2Fparsers%2Fqasm3_parser%2Fpasses%2FTypeCheckPass.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-aW5jbHVkZS9tcXQtY29yZS9wYXJzZXJzL3Fhc20zX3BhcnNlci9wYXNzZXMvVHlwZUNoZWNrUGFzcy5ocHA=) | `96.1% <100.0%> (+7.6%)` | :arrow_up: | | [src/parsers/QASM3Parser.cpp](https://app.codecov.io/gh/cda-tum/mqt-core/pull/618?src=pr&el=tree&filepath=src%2Fparsers%2FQASM3Parser.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-c3JjL3BhcnNlcnMvUUFTTTNQYXJzZXIuY3Bw) | `90.5% <100.0%> (ø)` | |