opencode/packages/codemode-rust/conformance/cases/throw-errors.js
2026-11-18 18:53:56 +01:00

2 lines
282 B
JavaScript

const kinds = [() => { throw new Error("e") }, () => { throw new TypeError("t") }, () => { throw new RangeError("r") }]
return kinds.map((f) => { try { f() } catch (e) { return [e.name, e.message, String(e), e instanceof Error, e instanceof TypeError, e instanceof RangeError] } })