Skip to content

Commit

Permalink
add a proper message lol
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyterkat committed Jun 6, 2024
1 parent aa4addd commit 1619aa8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions crates/byondapi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ pub fn bind(attr: TokenStream, item: TokenStream) -> TokenStream {
Ok(val) => val,
Err(e) => {
let error_string = ::byondapi::value::ByondValue::try_from(::std::format!("{e:?}")).unwrap();
::byondapi::global_call::call_global_id(byond_string!("stack_trace"), &[error_string]).unwrap();
::byondapi::global_call::call_global_id({
static STACK_TRACE: ::std::sync::OnceLock<u32> = ::std::sync::OnceLock::new();
*STACK_TRACE.get_or_init(|| ::byondapi::byond_string::str_id_of("stack_trace")
.expect("byondapi-rs implicitly expects stack_trace to exist as a proc for error reporting purposes, this proc doesn't exist!")
)
}
,&[error_string]).unwrap();
::byondapi::value::ByondValue::null()
}
}
Expand Down Expand Up @@ -232,7 +238,13 @@ pub fn bind_raw_args(attr: TokenStream, item: TokenStream) -> TokenStream {
Ok(val) => val,
Err(e) => {
let error_string = ::byondapi::value::ByondValue::try_from(::std::format!("{e:?}")).unwrap();
::byondapi::global_call::call_global_id(byond_string!("stack_trace"), &[error_string]).unwrap();
::byondapi::global_call::call_global_id({
static STACK_TRACE: ::std::sync::OnceLock<u32> = ::std::sync::OnceLock::new();
*STACK_TRACE.get_or_init(|| ::byondapi::byond_string::str_id_of("stack_trace")
.expect("byondapi-rs implicitly expects stack_trace to exist as a proc for error reporting purposes, this proc doesn't exist!")
)
}
,&[error_string]).unwrap();
::byondapi::value::ByondValue::null()
}
}
Expand Down

0 comments on commit 1619aa8

Please sign in to comment.