MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / set_host_error_by_id

Function set_host_error_by_id

compiler/src/main/exports.rs:286–295  ·  view source on GitHub ↗
(id: u32, kind: u32, msg_handle: u32)

Source from the content-addressed store, hash-verified

284/* Raise an error into the `WaitingHostCall(id)` coro so its try/except can catch it; one failed host call affects only its coro. `msg_handle` is a string Val (via `encodeAny`). Same return codes as `set_host_result`. */
285#[unsafe(no_mangle)]
286pub unsafe extern "C" fn set_host_error_by_id(id: u32, kind: u32, msg_handle: u32) -> i32 {
287 with_paused_vm(msg_handle, |vm, val| {
288 let msg = match vm.heap.get(val) {
289 HeapObj::Str(s) => s.clone(),
290 _ => String::new(),
291 };
292 let e = super::errors::error_from_kind(kind, msg);
293 if vm.inject_host_error_by_id(id as u64, e) { 0 } else { 2 }
294 })
295}
296
297#[unsafe(no_mangle)]
298pub extern "C" fn last_yield_deadline_ns() -> u64 {

Callers

nothing calls this directly

Calls 4

with_paused_vmFunction · 0.85
error_from_kindFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected