ThorVG WebCanvas API - v1.1.4
    Preparing search index...

    Interface ErrorHandler

    Error handler callback function.

    Handles both ThorVG WASM errors (ThorVGError) and JavaScript errors (Error). Use instanceof to distinguish between error types.

    import { init } from '@thorvg/webcanvas';

    const TVG = await init({
    onError: (error, context) => {
    if (error instanceof ThorVGError) {
    // WASM error - has error.code
    console.log('WASM error code:', error.code);
    } else {
    // JavaScript error
    console.log('JS error:', error.message);
    }
    }
    });