// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Mocha from "mocha";
import * as Test_utils from "./test_utils.mjs";
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.mjs";

let A = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.A");

let B = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.B");

let C = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.C");

function test_js_error4() {
  try {
    JSON.parse(` {"x"}`);
    return 1;
  } catch (raw_e) {
    let e = Primitive_exceptions.internalToException(raw_e);
    if (e.RE_EXN_ID === "Not_found") {
      return 2;
    }
    if (e.RE_EXN_ID === "Invalid_argument" && e._1 === "x") {
      return 3;
    }
    if (e.RE_EXN_ID === A) {
      if (e._1 !== 2) {
        return 7;
      } else {
        return 4;
      }
    } else if (e.RE_EXN_ID === B) {
      return 5;
    } else if (e.RE_EXN_ID === C && e._1 === 1 && e._2 === 2) {
      return 6;
    } else {
      return 7;
    }
  }
}

function f(g) {
  try {
    return g();
  } catch (raw_exn) {
    let exn = Primitive_exceptions.internalToException(raw_exn);
    if (exn.RE_EXN_ID === "Not_found") {
      return 1;
    }
    throw exn;
  }
}

Mocha.describe("Exception_rebound_err_test", () => {
  Mocha.test("exception rebound error test", () => Test_utils.eq("File \"exception_rebound_err_test.res\", line 29, characters 7-14", test_js_error4(), 7));
});

export {
  A,
  B,
  C,
  test_js_error4,
  f,
}
/*  Not a pure module */
