MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / execute_main

Function execute_main

ciphercore-utils/src/execute_main.rs:12–25  ·  view source on GitHub ↗

Executes CipherCore code such that all the internal errors are properly formatted and logged. # Arguments `f` - closure without arguments containing CipherCore code and returning `Result<()>`

(f: T)

Source from the content-addressed store, hash-verified

10///
11/// `f` - closure without arguments containing CipherCore code and returning `Result<()>`
12pub fn execute_main<T, E>(f: T)
13where
14 T: FnOnce() -> Result<(), E> + std::panic::UnwindSafe,
15 E: Display,
16{
17 let result = std::panic::catch_unwind(|| {
18 let result = f();
19 if let Err(e) = result {
20 error!("CipherCore Error:\n{e}");
21 process::exit(1);
22 }
23 });
24 process_result(result);
25}
26
27#[doc(hidden)]
28pub fn extract_panic_message(e: Box<dyn std::any::Any + Send>) -> Option<String> {

Callers 11

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 1

process_resultFunction · 0.85

Tested by 1

mainFunction · 0.68