mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
changes after review
This commit is contained in:
parent
793ab8ec16
commit
eb61d352f5
4 changed files with 36 additions and 25 deletions
|
@ -202,12 +202,12 @@ impl<'a> ImportDispatcher for TestDispatcher<'a> {
|
|||
self.wasi.dispatch(function_name, arguments, memory)
|
||||
} else if module_name == "env" && function_name == "send_panic_msg_to_rust" {
|
||||
let msg_ptr = arguments[0].expect_i32().unwrap();
|
||||
let tag = arguments[1].expect_i32().unwrap();
|
||||
let panic_tag = arguments[1].expect_i32().unwrap();
|
||||
let roc_msg = RocStr::decode(memory, msg_ptr as _);
|
||||
let msg = match tag {
|
||||
0 => format!(r#"Roc failed with message: "{}""#, roc_msg),
|
||||
1 => format!(r#"User crash with message: "{}""#, roc_msg),
|
||||
tag => format!(r#"Got an invald panic tag: "{}""#, tag),
|
||||
let msg = match panic_tag {
|
||||
0 => format!(r#"Roc failed with message: "{roc_msg}""#),
|
||||
1 => format!(r#"User crash with message: "{roc_msg}""#),
|
||||
tag => format!(r#"Got an invald panic tag: "{panic_tag}""#),
|
||||
};
|
||||
panic!("{}", msg)
|
||||
} else {
|
||||
|
|
|
@ -124,11 +124,11 @@ void roc_dealloc(void *ptr, unsigned int alignment)
|
|||
|
||||
//--------------------------
|
||||
|
||||
extern void send_panic_msg_to_rust(void* msg, uint32_t tag_id);
|
||||
extern void send_panic_msg_to_rust(void* msg, uint32_t panic_tag);
|
||||
|
||||
void roc_panic(void* msg, unsigned int tag_id)
|
||||
void roc_panic(void* msg, unsigned int panic_tag)
|
||||
{
|
||||
send_panic_msg_to_rust(msg, tag_id);
|
||||
send_panic_msg_to_rust(msg, panic_tag);
|
||||
exit(101);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue