mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
- Add m_hasPendingNapiException flag to track NAPI exception state - Modify napi_throw and throwErrorWithCStrings to check for pending exceptions - Ignore subsequent throws when exception is already pending - Update NAPI preamble to check for pending exceptions - This prevents crashes from multiple ThrowAsJavaScriptException calls 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
637 B
JavaScript
22 lines
637 B
JavaScript
import { test, expect } from "bun:test";
|
|
import { join } from "path";
|
|
|
|
const addonPath = join(import.meta.dir, "napi-app", "build", "Debug", "multiple_exceptions_addon.node");
|
|
|
|
let addon;
|
|
try {
|
|
addon = require(addonPath);
|
|
console.log("Addon loaded successfully");
|
|
} catch (error) {
|
|
console.warn("Could not load addon:", error.message);
|
|
addon = null;
|
|
}
|
|
|
|
// Test just one simple function at a time
|
|
test.skipIf(!addon)("simple exception test", () => {
|
|
console.log("About to call throwMultiple...");
|
|
expect(() => {
|
|
const result = addon.throwMultiple();
|
|
console.log("throwMultiple returned:", result);
|
|
}).toThrow();
|
|
}); |