1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#[macro_export]
macro_rules! zome_assert {
($stack:ident, $cond:expr) => {
if !$cond {
let error_report = ribosome_error_report!(format!(
r#"Zome assertion failed: `{}`"#,
stringify!($cond)
));
let res = store_as_json(&mut $stack, error_report);
return res.unwrap().encode();
}
};
}
#[macro_export]
macro_rules! ribosome_error_code {
($s:ident) => {
Ok(Some(RuntimeValue::I32(
::holochain_wasm_utils::holochain_core_types::error::RibosomeErrorCode::$s as i32,
)))
};
}
#[macro_export]
macro_rules! ribosome_error_report {
($s:expr) => {
::holochain_wasm_utils::holochain_core_types::error::RibosomeErrorReport {
description: $s.to_string(),
file_name: file!().to_string(),
line: line!().to_string(),
}
};
}