1
0
Fork 0

runtime/eh_artiq: updated exception IDs

Fixes #166
This commit is contained in:
pca006132 2022-02-28 21:15:07 +08:00
parent 880ba6b206
commit f38117774f
1 changed files with 7 additions and 3 deletions

View File

@ -273,7 +273,7 @@ pub unsafe extern fn raise(exception: *const Exception) -> ! {
error!("too many nested exceptions"); error!("too many nested exceptions");
// TODO: better reporting? // TODO: better reporting?
let exception = Exception { let exception = Exception {
id: get_exception_id("runtimeerror"), id: get_exception_id("RuntimeError"),
file: file!().as_c_slice(), file: file!().as_c_slice(),
line: line!(), line: line!(),
column: column!(), column: column!(),
@ -405,13 +405,17 @@ extern fn stop_fn(_version: c_int,
} }
} }
static EXCEPTION_ID_LOOKUP: [(&str, u32); 6] = [ static EXCEPTION_ID_LOOKUP: [(&str, u32); 10] = [
("runtimeerror", 0), ("RuntimeError", 0),
("RTIOUnderflow", 1), ("RTIOUnderflow", 1),
("RTIOOverflow", 2), ("RTIOOverflow", 2),
("RTIODestinationUnreachable", 3), ("RTIODestinationUnreachable", 3),
("DMAError", 4), ("DMAError", 4),
("I2CError", 5), ("I2CError", 5),
("CacheError", 6),
("SPIError", 7),
("ZeroDivisionError", 8),
("IndexError", 9)
]; ];
pub fn get_exception_id(name: &str) -> u32 { pub fn get_exception_id(name: &str) -> u32 {