On rare occasions, a Javascript object that isn't an error gets thrown.
This PR ensures that we are handling this situation without anything going
too far astray.

This is a followup to #2236.
Add handling and tests for weird Javascript errors. On rare occasions, a Javascript object that isn't an error gets thrown.
This PR ensures that we are handling this situation without anything going
too far astray.

This is a followup to #2236.
import assert from "assert";

// for a persistence-related browser test see /src/tests/test_filesystem.py

describe("FS", () => {
  const exists = () => {
    return pyodide.runPython("import os; os.path.exists('/tmp/js-test')");
  };
  it("no dir", async () => assert.strictEqual(exists(), false));
  it("mkdir", async () => pyodide.FS.mkdir("/tmp/js-test"));
  it("made dir", async () => assert.strictEqual(exists(), true));
});

import assert from "assert";

// for a persistence-related browser test see /src/tests/test_filesystem.py

describe("FS", () => {
  const exists = () => {
    return pyodide.runPython("import os; os.path.exists('/tmp/js-test')");
  };
  it("no dir", async () => assert.strictEqual(exists(), false));
  it("mkdir", async () => pyodide.FS.mkdir("/tmp/js-test"));
  it("made dir", async () => assert.strictEqual(exists(), true));
});
