{"record":{"id":"f37bd2acbc1ba34e","repo":"swc-project/swc","slug":"swc-does-not-support-throw-expressions","errorCode":null,"errorMessage":"swc does not support throw expressions","messagePattern":"swc does not support throw expressions","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/swcify/expr.rs","lineNumber":595,"sourceCode":"    fn swcify(self, ctx: &Context) -> Self::Output {\n        UnaryExpr {\n            span: ctx.span(&self.base),\n            op: self.operator.swcify(ctx),\n            arg: self.argument.swcify(ctx),\n        }\n    }\n}\n\nimpl Swcify for UnaryExprOp {\n    type Output = UnaryOp;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        match self {\n            UnaryExprOp::Void => {\n                op!(\"void\")\n            }\n            UnaryExprOp::Throw => {\n                panic!(\"swc does not support throw expressions\")\n            }\n            UnaryExprOp::Delete => {\n                op!(\"delete\")\n            }\n            UnaryExprOp::LogicalNot => {\n                op!(\"!\")\n            }\n            UnaryExprOp::Plus => {\n                op!(unary, \"+\")\n            }\n            UnaryExprOp::Negation => {\n                op!(unary, \"-\")\n            }\n            UnaryExprOp::BitwiseNot => {\n                op!(\"~\")\n            }\n            UnaryExprOp::Typeof => {\n                op!(\"typeof\")","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/swcify/expr.rs#L577-L613","documentation":"Raised in `Swcify for UnaryExprOp` (swcify/expr.rs:595). Babel's AST can represent the stage-1 `throw` expression via a UnaryExpr operator, but swc's UnaryOp has no `throw` variant because the proposal was abandoned and never shipped in ECMAScript. Converting such a UnaryExpr to swc is therefore impossible, and the code panics when it encounters UnaryExprOp::Throw. The unsupported Throw operator is the input at fault.","triggerScenarios":"Thrown at crates/swc_estree_compat/src/swcify/expr.rs:595 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject inputs containing throw expressions before conversion with an explicit 'throw expressions are not supported' error","Strip or transform throw expressions in a preprocessing pass if the surrounding tooling can tolerate dropping them","Do not feed Babel ASTs produced with throw-expression syntax enabled into the swcify path"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}