{"record":{"id":"92c5c3ecef8b91ac","repo":"wasmerio/wasmer","slug":"exception-handling-is-not-yet-supported-in-v8","errorCode":null,"errorMessage":"Exception handling is not yet supported in v8","messagePattern":"Exception handling is not yet supported in v8","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/api/src/backend/v8/entities/exception.rs","lineNumber":25,"sourceCode":"    AsStoreMut, AsStoreRef, Tag, Value,\n    v8::vm::{VMException, VMExceptionRef},\n};\n\nuse super::store::StoreHandle;\n\n#[derive(Debug, Clone, PartialEq, Eq)]\n/// A WebAssembly `tag` in the `v8` runtime.\npub(crate) struct Exception {\n    pub(crate) handle: VMException,\n}\n\nunsafe impl Send for Exception {}\nunsafe impl Sync for Exception {}\n\nimpl Exception {\n    /// Create a new [`Exception`].\n    pub fn new(store: &mut impl AsStoreMut, tag: Tag, payload: &[Value]) -> Self {\n        unimplemented!(\"Exception handling is not yet supported in v8\");\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":28,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/api/src/backend/v8/entities/exception.rs#L7-L28","documentation":"The v8 backend does not implement WebAssembly exception handling. `Exception::new` is an unconditional stub, so any attempt to create an exception (host-side `raise`/throw through wasmer) panics with this message.","triggerScenarios":"Calling `Exception::new(&mut store, tag, payload)` in code built with the v8 backend (`--features v8` / default native v8 features) — regardless of arguments.","commonSituations":"Cross-backend code implementing wasm exception-handling (`throw`/`try_table`) that runs on sys/js but is compiled for v8; enabling v8 features in an app that uses wasmer's exceptions API.","solutions":["Use the sys backend (`wasmer = { features = [\"sys\"] }`) which supports exception handling","Guard exception code behind a backend feature check and provide a non-exception fallback for v8 builds","Model errors as return values (e.g. Result-typed exports) instead of wasm exceptions when targeting v8"],"exampleFix":"// before\nlet ex = Exception::new(&mut store, tag, &payload); // panics on v8\n// after\n#[cfg(feature = \"sys\")]\nlet ex = Exception::new(&mut store, tag, &payload);\n#[cfg(feature = \"v8\")]\nreturn Err(unsupported_on_v8());","handlingStrategy":"fallback","validationCode":"fn exceptions_supported() -> bool {\n    cfg!(feature = \"sys\") // v8 backend has no exception support\n}","typeGuard":"fn exceptions_supported() -> bool {\n    cfg!(feature = \"sys\")\n}","tryCatchPattern":"if !exceptions_supported() {\n    return Err(anyhow!(\"exception handling requires the sys backend\"));\n}\nlet ex = Exception::new(&mut store, tag, &payload);","preventionTips":["Compile-time gate exception code with cfg(feature = \"sys\")","Offer non-exception error modeling for v8 builds","Check backend capabilities before calling exception APIs"],"tags":["wasm","v8-backend","exceptions","unimplemented"],"backgroundTag":"unimplemented-backend-feature","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}