pub enum ScriptError {
Compile {
uri: String,
line: u32,
col: u32,
message: String,
},
Runtime(String),
}Expand description
Errors a ScriptHost can surface from load or tick.
Structured compile errors carry the source URI and the offending
(line, col) so editor / LSP layers can place a squiggle without
re-parsing the error message. Runtime is still a free-form string;
Rhai’s runtime errors don’t always carry positions and the
trait-level shape is “best effort”.
Variants§
Compile
Source failed to parse / compile.
Fields
Runtime(String)
Source compiled but execution failed.
Implementations§
Source§impl ScriptError
impl ScriptError
Sourcepub fn relocate(self, uri: &str, map: &SourceMap) -> Self
pub fn relocate(self, uri: &str, map: &SourceMap) -> Self
Point a compile error in a concatenated program at the file and line the author wrote.
uri is the program’s own name and map says where each of its
pieces was read from. An error about another file (a module the
program imports) already names that file and is returned unchanged,
as is a runtime error or one with no known line.
Trait Implementations§
Source§impl Debug for ScriptError
impl Debug for ScriptError
Source§impl Display for ScriptError
impl Display for ScriptError
Source§impl Error for ScriptError
impl Error for ScriptError
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()