pub fn set_panic_hook()Expand description
Set up better panic messages for debugging in browser console.
This function configures the panic hook to provide detailed error messages when the WASM module panics. Without this, panics will show generic “unreachable executed” messages that are difficult to debug.
§When to Call
Call this once during initialization, before any other API calls:
import init, { set_panic_hook } from './lib3mf_wasm.js';
await init();
set_panic_hook(); // Call once at startup
// Now make other API calls...§Performance
This adds a small amount of overhead to panics, but has no impact on normal execution. It’s recommended for development builds but can be omitted in production if you want minimal bundle size.