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

Function err_to_kind

compiler/src/main/errors.rs:9–23  ·  view source on GitHub ↗

VmErr classifier for the ABI boundary. */

(e: &VmErr)

Source from the content-addressed store, hash-verified

7
8/* VmErr classifier for the ABI boundary. */
9pub(super) fn err_to_kind(e: &VmErr) -> ErrorKind {
10 match e {
11 VmErr::Type(_) | VmErr::TypeMsg(_) => ErrorKind::Type,
12 VmErr::Value(_) => ErrorKind::Value,
13 VmErr::Runtime(_) => ErrorKind::Runtime,
14 VmErr::Attribute(_) | VmErr::Name(_) => ErrorKind::Attribute,
15 VmErr::Raised(s) => {
16 if s.starts_with("ValueError") { ErrorKind::Value }
17 else if s.starts_with("IndexError") { ErrorKind::Index }
18 else if s.starts_with("KeyError") { ErrorKind::Key }
19 else { ErrorKind::Runtime }
20 }
21 _ => ErrorKind::Runtime,
22 }
23}
24
25pub(super) fn stash_error(e: VmErr) {
26 let kind = err_to_kind(&e);

Callers 1

stash_errorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected