SDK for writing Myrmic cells (WASM modules deployed and managed by the sorg infrastructure): host function bindings for db, tap, outlet, gpio, ble, gateway, cell messaging, logging and time, plus the #[cmd]/#[monitor] export macros.
//! Wrappers for host functions for error reporting beyond logging.
usecore::ffi::c_int;usecrate::{ApiResult,error::ErrorCode};modc_functions{usecore::ffi::c_int;#[link(wasm_import_module ="error")]unsafeextern"C"{/// Requests the host to store the provided String as an error message of the calling module
////// # Arguments
/// - buffer: pointer to a buffer containing the string with the error message
/// - length: the number of bytes that the host should read from the buffer
////// # Returns:
/// - [`crate::SUCCESS`] on success
/// - [`crate::GENERIC_ERROR`] on failure
pub(super)fnreport_error(buffer:*constu8, length: c_int)->i32;}}/// Stores the provided string as an error message in the error queue of the calling module
pubfnreport_error(err_msg:&str)->ApiResult<()>{// SAFETY: calling the imported function with pointer and length of guest linear memory
// used for this specific purpose.
unsafe{c_functions::report_error(err_msg.as_ptr(), err_msg.len()asc_int)}.to_result()}