throw_str

Function throw_str 

Source
pub fn throw_str(s: &str) -> !
Expand description

Throws a JS exception.

This function will throw a JS exception with the message provided. The function will not return as the Wasm stack will be popped when the exception is thrown.

Note that it is very easy to leak memory with this function because this function, unlike panic! on other platforms, will not run destructors. It’s recommended to return a Result where possible to avoid the worry of leaks.

If you need destructors to run, consider using panic! when building with -Cpanic=unwind. If the std feature is used panics will be caught at the JavaScript boundary and converted to JavaScript exceptions.