Skip to content
Snippets Groups Projects
Unverified Commit dd563360 authored by GyDi's avatar GyDi Committed by GitHub
Browse files

fix: script exception handle

parent 7f6dac42
No related branches found
No related tags found
No related merge requests found
......@@ -41,9 +41,9 @@ pub fn use_script(script: String, config: Mapping) -> Result<(Mapping, Vec<(Stri
}}"#
);
let result: String = ctx.eval(code.as_str())?;
// if result.starts_with("__error_flag__") {
// anyhow::bail!(result.slice_unchecked(begin, end));
// }
if result.starts_with("__error_flag__") {
anyhow::bail!(result[15..].to_owned());
}
if result == "\"\"" {
anyhow::bail!("main function should return object");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment