in src/plugin/mod.rs [140:165]
fn log_exception(span: &mut impl HandleSpanObject) -> Option<&mut ZObj> {
let mut ex = unsafe { ZObj::try_from_mut_ptr(eg!(exception)) };
if let Some(ex) = ex.as_mut() {
let span_object = span.span_object_mut();
span_object.is_error = true;
let mut logs = Vec::new();
if let Ok(class_name) = ex.get_class().get_name().to_str() {
logs.push(("error.kind", class_name.to_owned()));
}
if let Some(message) = ex.get_property("message").as_z_str() {
if let Ok(message) = message.to_str() {
logs.push(("message", message.to_owned()));
}
}
if let Ok(stack) = ex.call("getTraceAsString", []) {
if let Some(stack) = stack.as_z_str().and_then(|s| s.to_str().ok()) {
logs.push(("stack", stack.to_owned()));
}
}
if !logs.is_empty() {
span_object.add_log(logs);
}
}
ex
}