#[non_exhaustive]pub enum ModuleError {
Interrupted(Id),
Timeout(Id),
Cursor(Id),
}
Expand description
An error type for script module analysis.
Some variants of this enum (such as Cursor) represent errors indicating that the arguments supplied to the function are not valid. Other variants indicate that the result cannot be computed due to specific reasons.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Interrupted(Id)
Indicates that the function cannot fulfill the request because another thread is attempting to revoke the current read or write access to this script module in a multi-threaded environment.
If you encounter this error in a worker thread, you should drop the module’s read or write access object to give priority to another thread. After dropping the access object, it is recommended to pause the worker thread for a short amount of time before retrying the operation by acquiring a new module access guard.
In single-threaded programs, this error should never occur unless access handles are manually triggered.
See the ScriptModule documentation for more details about multi-threaded analysis tools.
Timeout(Id)
Indicates that the analysis operation cannot be completed within the predefined amount of time.
This type of error is rare and may occur only in specific edge cases. The internal semantic analysis algorithm allocates generous timeout limits for semantic operations, which should be sufficient to handle a wide range of semantic requests in large source code texts, even on low-end machines. However, if a request operation takes too long, the analyzer may decide to give up and return a Timeout error.
In such cases, rerunning the operation typically has no benefit, so you can either display an error message to the user or silently ignore the request. If implementing a hand-written LSP server, you may choose to return an empty response to the language client.
Cursor(Id)
Indicates that the addressed source code character or range of characters is not valid for the underlying script module.
Trait Implementations§
Source§impl Clone for ModuleError
impl Clone for ModuleError
Source§fn clone(&self) -> ModuleError
fn clone(&self) -> ModuleError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ModuleError
impl Debug for ModuleError
Source§impl Display for ModuleError
impl Display for ModuleError
Source§impl Error for ModuleError
impl Error for ModuleError
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
Source§impl Hash for ModuleError
impl Hash for ModuleError
Source§impl Identifiable for ModuleError
impl Identifiable for ModuleError
Source§impl Ord for ModuleError
impl Ord for ModuleError
Source§fn cmp(&self, other: &ModuleError) -> Ordering
fn cmp(&self, other: &ModuleError) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ModuleError
impl PartialEq for ModuleError
Source§impl PartialOrd for ModuleError
impl PartialOrd for ModuleError
impl Copy for ModuleError
impl Eq for ModuleError
impl StructuralPartialEq for ModuleError
Auto Trait Implementations§
impl Freeze for ModuleError
impl RefUnwindSafe for ModuleError
impl Send for ModuleError
impl Sync for ModuleError
impl Unpin for ModuleError
impl UnwindSafe for ModuleError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
. Read more