#[non_exhaustive]pub enum AnalysisError {
Show 13 variants
Interrupted,
MissingDocument,
ImmutableDocument,
InvalidSpan,
UninitAttribute,
UninitSlot,
MissingAttribute,
MissingSlot,
UninitSemantics,
MissingSemantics,
TypeMismatch,
MissingFeature,
Timeout,
}Expand description
An error occurring during semantics analysis.
There are two types of errors:
-
An abnormal that indicate an error in the user code, such as an issue in the Grammar configuration or misuse of the analysis API. In this case, it is recommended to panic as early as possible such that the panic backtrace will point to the exact piece of code of where the error occurred.
-
A normal error that should be propagated up to the caller of the current function that returns an AnalysisResult. For example, such errors should be returned from the Computable::compute implementations.
For convenience, the AnalysisResult type extended by the AnalysisResultEx trait with the AnalysisResultEx::unwrap_abnormal function that panics in place if the underlying error is abnormal, or passes the Result object through if the underlying variant is Ok or denotes a normal error.
Currently, the AnalysisError defines two normal errors:
-
The Interrupted error, which denotes that the operation cannot be completed, because the underlying task has been signaled to shut down.
-
The Timeout error, which denotes that the operation computation exceeded predefined timeout. This error may occur due to recursion in the attributes graph, which is a user code issue, or just a normal time out if the operation takes too long. In the production builds (when the
debug_assertionsfeature is disabled), this type of error is a normal error, but in non-production builds, this error considered abnormal.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Interrupted
The operation cannot be completed because the underlying task has been signaled to shut down.
This error is a normal error.
MissingDocument
The document referred to by the specified id does not exits in the Analyzer.
This error is an abnormal error.
ImmutableDocument
The content edit operation cannot be performed on the specified document, because the document is not mutable.
This error is an abnormal error.
InvalidSpan
The specified span is not valid for the specified document.
This error is an abnormal error.
UninitAttribute
An attempt to access an Attr object which is not fully initialized.
See Feature Lifetime for details.
This error is an abnormal error.
UninitSlot
An attempt to access an Slot object which is not fully initialized.
See Feature Lifetime for details.
This error is an abnormal error.
MissingAttribute
The referred attribute does not exist in the Analyzer’s semantic graph.
This error is an abnormal error.
MissingSlot
The referred slot does not exist in the Analyzer’s semantic graph.
This error is an abnormal error.
UninitSemantics
An attempt to access a Semantics object which is not fully initialized.
See Feature Lifetime for details.
This error is an abnormal error.
MissingSemantics
The specified syntax tree node does not have semantics.
This error may occur, for example, if the Grammar object does not specify any semantics for any node, or if a particular type of the node does not specify semantics.
This error is an abnormal error.
TypeMismatch
The attribute value type is differ from the specified type.
This error is an abnormal error.
MissingFeature
The specified feature does not exist in the syntax tree node’s semantics.
This error is an abnormal error.
Timeout
Operation timeout.
This error indicates that the requested operation takes too long to finish, which is generally acceptable, or if the semantics graph has a recursion, which is an issue in the semantics design.
This error is a normal error if the target build is a production
build (debug_assertions feature is disabled). Otherwise, the error is
abnormal.
Implementations§
Source§impl AnalysisError
impl AnalysisError
Sourcepub fn is_abnormal(&self) -> bool
pub fn is_abnormal(&self) -> bool
Returns true if the underlying error object denotes an issue in the user code, or in the Grammar configuration.
Trait Implementations§
Source§impl Clone for AnalysisError
impl Clone for AnalysisError
Source§fn clone(&self) -> AnalysisError
fn clone(&self) -> AnalysisError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AnalysisError
Source§impl Debug for AnalysisError
impl Debug for AnalysisError
Source§impl Display for AnalysisError
impl Display for AnalysisError
impl Eq for AnalysisError
Source§impl Error for AnalysisError
impl Error for AnalysisError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()