microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
source/resource_estimator/src/estimates/error.rs
115lines ยท modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | use miette::Diagnostic; |
| 5 | use thiserror::Error; |
| 6 | |
| 7 | #[derive(Debug, Error, Diagnostic)] |
| 8 | pub enum Error { |
| 9 | /// Input algorithm has no resources |
| 10 | /// |
| 11 | /// โ
This does not contain user data and can be logged |
| 12 | /// ๐งโ๐ป This indicates a user error |
| 13 | #[error("Algorithm requires at least one magic state or measurement to estimate resources")] |
| 14 | #[diagnostic(code("Qsc.Estimates.AlgorithmHasNoResources"))] |
| 15 | AlgorithmHasNoResources, |
| 16 | /// The number of algorithmic logical qubits cannot be computed. |
| 17 | /// |
| 18 | /// โ
This does not contain user data and can be logged |
| 19 | /// โ
This error cannot be triggered by the system. |
| 20 | #[error("Cannot compute the number of algorithmic logical qubits: {0}")] |
| 21 | #[diagnostic(code("Qsc.Estimates.AlgorithmicLogicalQubitsComputationFailed"))] |
| 22 | AlgorithmicLogicalQubitsComputationFailed(String), |
| 23 | /// The algorithmic logical depth cannot be computed. |
| 24 | /// |
| 25 | /// โ
This does not contain user data and can be logged |
| 26 | /// โ
This error cannot be triggered by the system. |
| 27 | #[error("Cannot compute the algorithmic logical depth: {0}")] |
| 28 | #[diagnostic(code("Qsc.Estimates.AlgorithmicLogicalDepthComputationFailed"))] |
| 29 | AlgorithmicLogicalDepthComputationFailed(String), |
| 30 | /// The number of required magic states cannot be computed. |
| 31 | /// |
| 32 | /// โ
This does not contain user data and can be logged |
| 33 | /// โ
This error cannot be triggered by the system. |
| 34 | #[error("Cannot compute the required number of magic states: {0}")] |
| 35 | #[diagnostic(code("Qsc.Estimates.NumberOfMagicStatesComputationFailed"))] |
| 36 | NumberOfMagicStatesComputationFailed(String), |
| 37 | /// Both constraints for maximal time and |
| 38 | /// maximal number of qubits are provided |
| 39 | /// |
| 40 | /// โ
This does not contain user data and can be logged |
| 41 | /// ๐งโ๐ป This indicates a user error |
| 42 | #[error( |
| 43 | "Both duration and number of physical qubits constraints are provided, but only one is allowed" |
| 44 | )] |
| 45 | #[diagnostic(code("Qsc.Estimates.BothDurationAndPhysicalQubitsProvided"))] |
| 46 | BothDurationAndPhysicalQubitsProvided, |
| 47 | /// No solution found for the provided maximum duration. |
| 48 | /// |
| 49 | /// โ
This does not contain user data and can be logged |
| 50 | /// ๐งโ๐ป This indicates a user error |
| 51 | #[error("No solution found for the provided maximum duration.")] |
| 52 | #[diagnostic(code("Qsc.Estimates.MaxDurationTooSmall"))] |
| 53 | MaxDurationTooSmall, |
| 54 | /// No solution found for the provided maximum number of physical qubits |
| 55 | /// |
| 56 | /// โ
This does not contain user data and can be logged |
| 57 | /// ๐งโ๐ป This indicates a user error |
| 58 | #[error("No solution found for the provided maximum number of physical qubits.")] |
| 59 | #[diagnostic(code("Qsc.Estimates.MaxPhysicalQubitsTooSmall"))] |
| 60 | MaxPhysicalQubitsTooSmall, |
| 61 | /// Logical depth scaling factor is too small |
| 62 | /// |
| 63 | /// ๐งโ๐ป This indicates a user error |
| 64 | #[error("Logical depth scaling factor is too small, it must be at least 1: {0}")] |
| 65 | #[diagnostic(code("Qsc.Estimates.LogicalDepthScalingFactorTooSmall"))] |
| 66 | LogicalDepthScalingFactorTooSmall(f64), |
| 67 | /// Resource estimation failed to find factories |
| 68 | /// |
| 69 | /// โ
This error cannot be triggered by the system. |
| 70 | #[error("Resource estimation failed to find factories: {0}")] |
| 71 | #[diagnostic(code("Qsc.Estimates.FactorySearchFailed"))] |
| 72 | FactorySearchFailed(String), |
| 73 | /// Constraint-based search only supports one magic state type. |
| 74 | /// |
| 75 | /// โ
This error cannot be triggered by the system, since only one magic |
| 76 | /// state type is supported. |
| 77 | #[error("Constraint-based search only supports one magic state type.")] |
| 78 | #[diagnostic(code("Qsc.Estimates.MultipleMagicStatesNotSupported"))] |
| 79 | MultipleMagicStatesNotSupported, |
| 80 | /// The number of physical qubits required for a code cannot be computed. |
| 81 | /// |
| 82 | /// โ
This does not contain user data and can be logged |
| 83 | /// ๐งโ๐ป This indicates a user error |
| 84 | #[error("The number of physical qubits required for a code cannot be computed: {0}")] |
| 85 | #[diagnostic(code("Qsc.Estimates.PhysicalQubitComputationFailed"))] |
| 86 | PhysicalQubitComputationFailed(String), |
| 87 | /// The number of logical qubits provided by a code cannot be computed. |
| 88 | /// |
| 89 | /// โ
This does not contain user data and can be logged |
| 90 | /// ๐งโ๐ป This indicates a user error |
| 91 | #[error("The number of logical qubits provided by a code cannot be computed: {0}")] |
| 92 | #[diagnostic(code("Qsc.Estimates.LogicalQubitComputationFailed"))] |
| 93 | LogicalQubitComputationFailed(String), |
| 94 | /// The logical cycle time cannot be computed. |
| 95 | /// |
| 96 | /// โ
This does not contain user data and can be logged |
| 97 | /// ๐งโ๐ป This indicates a user error |
| 98 | #[error("The logical cycle time cannot be computed: {0}")] |
| 99 | #[diagnostic(code("Qsc.Estimates.LogicalCycleTimeComputationFailed"))] |
| 100 | LogicalCycleTimeComputationFailed(String), |
| 101 | /// The logical error rate cannot be computed. |
| 102 | /// |
| 103 | /// โ
This does not contain user data and can be logged |
| 104 | /// ๐งโ๐ป This indicates a user error |
| 105 | #[error("The logical error rate cannot be computed: {0}")] |
| 106 | #[diagnostic(code("Qsc.Estimates.LogicalErrorRateComputationFailed"))] |
| 107 | LogicalErrorRateComputationFailed(String), |
| 108 | /// The code parameter cannot be computed. |
| 109 | /// |
| 110 | /// โ
This does not contain user data and can be logged |
| 111 | /// ๐งโ๐ป This indicates a user error |
| 112 | #[error("The code parameter cannot be computed: {0}")] |
| 113 | #[diagnostic(code("Qsc.Estimates.CodeParameterComputationFailed"))] |
| 114 | CodeParameterComputationFailed(String), |
| 115 | } |
| 116 | |