(span: &mut impl HandleSpanObject)
| 138 | } |
| 139 | |
| 140 | fn log_exception(span: &mut impl HandleSpanObject) -> Option<&mut ZObj> { |
| 141 | let mut ex = unsafe { ZObj::try_from_mut_ptr(eg!(exception)) }; |
| 142 | if let Some(ex) = ex.as_mut() { |
| 143 | let span_object = span.span_object_mut(); |
| 144 | span_object.is_error = true; |
| 145 | |
| 146 | let mut logs = Vec::new(); |
| 147 | if let Ok(class_name) = ex.get_class().get_name().to_str() { |
| 148 | logs.push(("error.kind", class_name.to_owned())); |
| 149 | } |
| 150 | if let Some(message) = ex.get_property("message").as_z_str() { |
| 151 | if let Ok(message) = message.to_str() { |
| 152 | logs.push(("message", message.to_owned())); |
| 153 | } |
| 154 | } |
| 155 | if let Ok(stack) = ex.call("getTraceAsString", []) { |
| 156 | if let Some(stack) = stack.as_z_str().and_then(|s| s.to_str().ok()) { |
| 157 | logs.push(("stack", stack.to_owned())); |
| 158 | } |
| 159 | } |
| 160 | if !logs.is_empty() { |
| 161 | span_object.add_log(logs); |
| 162 | } |
| 163 | } |
| 164 | ex |
| 165 | } |
no outgoing calls
no test coverage detected