diff --git a/CHANGELOG.md b/CHANGELOG.md index e71797f25f..f2478cabb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ # 12.0.0-alpha.3 (Unreleased) +#### :bug: Bug fix + +- Revert Throws an instance of JavaScript's `new Error()` and adds the extension payload for `cause` option introduced in https://github.com/rescript-lang/rescript-compiler/pull/6611. https://github.com/rescript-lang/rescript-compiler/pull/7016 + # 12.0.0-alpha.2 #### :rocket: New Feature @@ -2623,4 +2627,4 @@ Features: # 1.0.0 -Initial release \ No newline at end of file +Initial release diff --git a/jscomp/core/js_dump.ml b/jscomp/core/js_dump.ml index 2e2a1d3aef..9a4fee77d2 100644 --- a/jscomp/core/js_dump.ml +++ b/jscomp/core/js_dump.ml @@ -97,11 +97,8 @@ type cxt = Ext_pp_scope.t let semi f = P.string f L.semi let comma f = P.string f L.comma -let new_error name cause = - E.new_ (E.js_global Js_dump_lit.error) [ name; cause ] - let exn_block_as_obj ~(stack : bool) (el : J.expression list) (ext : J.tag_info) - : J.expression = + : J.expression_desc = let field_name = match ext with | Blk_extension -> ( @@ -111,29 +108,12 @@ let exn_block_as_obj ~(stack : bool) (el : J.expression list) (ext : J.tag_info) fun i -> match i with 0 -> Literals.exception_id | i -> ss.(i - 1)) | _ -> assert false in - let cause = - { - J.expression_desc = - Object (List.mapi (fun i e -> (Js_op.Lit (field_name i), e)) el); - comment = None; - } - in - if stack then - new_error (List.hd el) - { - J.expression_desc = Object [ (Lit Js_dump_lit.cause, cause) ]; - comment = None; - } - else cause - -let exn_ref_as_obj e : J.expression = - let cause = { J.expression_desc = e; comment = None; } in - new_error - (E.record_access cause Js_dump_lit.exception_id 0l) - { - J.expression_desc = Object [ (Lit Js_dump_lit.cause, cause) ]; - comment = None; - } + Object + (if stack then + Ext_list.mapi_append el + (fun i e -> (Js_op.Lit (field_name i), e)) + [ (Js_op.Lit "Error", E.new_ (E.js_global "Error") []) ] + else Ext_list.mapi el (fun i e -> (Js_op.Lit (field_name i), e))) let rec iter_lst cxt (f : P.t) ls element inter = match ls with @@ -777,7 +757,7 @@ and expression_desc cxt ~(level : int) f x : cxt = ]) | _ -> assert false) | Caml_block (el, _, _, ((Blk_extension | Blk_record_ext _) as ext)) -> - expression cxt ~level f (exn_block_as_obj ~stack:false el ext) + expression_desc cxt ~level f (exn_block_as_obj ~stack:false el ext) | Caml_block (el, _, tag, Blk_record_inlined p) -> let untagged = Ast_untagged_variants.process_untagged p.attrs in let objs = @@ -1239,8 +1219,8 @@ and statement_desc top cxt f (s : J.statement_desc) : cxt = let e = match e.expression_desc with | Caml_block (el, _, _, ((Blk_extension | Blk_record_ext _) as ext)) -> - { e with expression_desc = (exn_block_as_obj ~stack:true el ext).expression_desc } - | exp -> { e with expression_desc = (exn_ref_as_obj exp).expression_desc } + { e with expression_desc = exn_block_as_obj ~stack:true el ext } + | _ -> e in P.string f L.throw; P.space f; diff --git a/jscomp/core/js_dump_lit.ml b/jscomp/core/js_dump_lit.ml index c341c7f1c6..fd53d77449 100644 --- a/jscomp/core/js_dump_lit.ml +++ b/jscomp/core/js_dump_lit.ml @@ -168,9 +168,3 @@ let block_variant = "variant" let block_simple_variant = "simpleVariant" let case = "case" - -let cause = "cause" - -let error = "Error" - -let exception_id = "RE_EXN_ID" diff --git a/jscomp/core/js_exp_make.ml b/jscomp/core/js_exp_make.ml index ebbd80d281..128e2daea0 100644 --- a/jscomp/core/js_exp_make.ml +++ b/jscomp/core/js_exp_make.ml @@ -416,7 +416,7 @@ let poly_var_value_access (e : t) = comment = None; } -let extension_access (e : t) ?name (pos : int32) : t = +let extension_access (e : t) name (pos : int32) : t = match e.expression_desc with | Array (l, _) (* Float i -- should not appear here *) | Caml_block (l, _, _, _) diff --git a/jscomp/core/js_exp_make.mli b/jscomp/core/js_exp_make.mli index 2e1cd072bb..f7d36bcc56 100644 --- a/jscomp/core/js_exp_make.mli +++ b/jscomp/core/js_exp_make.mli @@ -170,7 +170,7 @@ val variant_access : t -> int32 -> t val cons_access : t -> int32 -> t -val extension_access : t -> ?name:string -> Int32.t -> t +val extension_access : t -> string option -> Int32.t -> t val record_assign : t -> int32 -> string -> t -> t diff --git a/jscomp/core/js_of_lam_block.ml b/jscomp/core/js_of_lam_block.ml index 5bcb8ff9ef..b665462d80 100644 --- a/jscomp/core/js_of_lam_block.ml +++ b/jscomp/core/js_of_lam_block.ml @@ -38,8 +38,8 @@ let field (field_info : Lam_compat.field_dbg_info) e (i : int32) = e i | Fld_poly_var_content -> E.poly_var_value_access e | Fld_poly_var_tag -> E.poly_var_tag_access e - | Fld_record_extension { name } -> E.extension_access e ~name i - | Fld_extension -> E.extension_access e i + | Fld_record_extension { name } -> E.extension_access e (Some name) i + | Fld_extension -> E.extension_access e None i | Fld_variant -> E.variant_access e i | Fld_cons -> E.cons_access e i | Fld_record_inline { name } -> E.inline_record_access e name i diff --git a/jscomp/core/lam_convert.ml b/jscomp/core/lam_convert.ml index 442dfe4ab1..adc645747f 100644 --- a/jscomp/core/lam_convert.ml +++ b/jscomp/core/lam_convert.ml @@ -22,17 +22,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +let caml_id_field_info : Lambda.field_dbg_info = + Fld_record { name = Literals.exception_id; mutable_flag = Immutable } + +let lam_caml_id : Lam_primitive.t = Pfield (0, caml_id_field_info) let prim = Lam.prim -let lam_extension_id = - let lam_caml_id : Lam_primitive.t = - let caml_id_field_info : Lambda.field_dbg_info = - Fld_record { name = Js_dump_lit.exception_id; mutable_flag = Immutable } - in - Pfield (0, caml_id_field_info) - in - fun loc (head : Lam.t) -> - prim ~primitive:lam_caml_id ~args:[ head ] loc +let lam_extension_id loc (head : Lam.t) = + prim ~primitive:lam_caml_id ~args:[ head ] loc let lazy_block_info : Lam_tag_info.t = Blk_record diff --git a/jscomp/runtime/caml_format.res b/jscomp/runtime/caml_format.res index 6fbee88afa..9705f3a482 100644 --- a/jscomp/runtime/caml_format.res +++ b/jscomp/runtime/caml_format.res @@ -709,7 +709,7 @@ let float_of_string: (string, exn) => float = %raw(`function(s,exn){ return Infinity; if (/^-inf(inity)?$/i.test(s)) return -Infinity; - throw new Error(exn.RE_EXN_ID, { cause: exn });; + throw exn; } `) diff --git a/jscomp/runtime/caml_js_exceptions.res b/jscomp/runtime/caml_js_exceptions.res index ea41d4e3df..6ef72df7c5 100644 --- a/jscomp/runtime/caml_js_exceptions.res +++ b/jscomp/runtime/caml_js_exceptions.res @@ -29,8 +29,8 @@ type js_error = {cause: exn} [Error] is defined here */ let internalToOCamlException = (e: unknown) => - if Caml_exceptions.is_extension((Obj.magic(e): js_error).cause) { - (Obj.magic(e): js_error).cause + if Caml_exceptions.is_extension(e) { + (Obj.magic(e): exn) } else { JsError(e) } diff --git a/jscomp/runtime/caml_lexer.res b/jscomp/runtime/caml_lexer.res index 28b277264c..69f228b58e 100644 --- a/jscomp/runtime/caml_lexer.res +++ b/jscomp/runtime/caml_lexer.res @@ -160,7 +160,7 @@ let caml_lex_engine_aux: ( if (state < 0) { lexbuf.lex_curr_pos = lexbuf.lex_last_pos; if (lexbuf.lex_last_action == -1) - throw new Error(exn.RE_EXN_ID, { cause: exn }) + throw exn else return lexbuf.lex_last_action; } @@ -308,7 +308,7 @@ let caml_new_lex_engine_aux: ( if (state < 0) { lexbuf.lex_curr_pos = lexbuf.lex_last_pos; if (lexbuf.lex_last_action == -1) - throw new Error(exn.RE_EXN_ID, { cause: exn }); + throw exn; else return lexbuf.lex_last_action; } diff --git a/jscomp/test/406_primitive_test.js b/jscomp/test/406_primitive_test.js index 7292ab1928..f094d9242d 100644 --- a/jscomp/test/406_primitive_test.js +++ b/jscomp/test/406_primitive_test.js @@ -34,12 +34,11 @@ function f() { try { for (let i = 0; i <= 200; ++i) { if (i === 10) { - throw new Error(A, { - cause: { - RE_EXN_ID: A, - _1: 0 - } - }); + throw { + RE_EXN_ID: A, + _1: 0, + Error: new Error() + }; } } @@ -49,9 +48,7 @@ function f() { if (exn.RE_EXN_ID === A) { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/UncurriedExternals.js b/jscomp/test/UncurriedExternals.js index 5ec20d4073..16c435711e 100644 --- a/jscomp/test/UncurriedExternals.js +++ b/jscomp/test/UncurriedExternals.js @@ -4,11 +4,10 @@ let React = require("react"); function dd() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let h = sum(1.0, 2.0); diff --git a/jscomp/test/adt_optimize_test.js b/jscomp/test/adt_optimize_test.js index 29405a959d..ee9aab3edd 100644 --- a/jscomp/test/adt_optimize_test.js +++ b/jscomp/test/adt_optimize_test.js @@ -182,16 +182,15 @@ function f11(x) { if (x.TAG === "D") { return 1; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "adt_optimize_test.res", - 202, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "adt_optimize_test.res", + 202, + 9 + ], + Error: new Error() + }; } exports.f = f; diff --git a/jscomp/test/argv_test.js b/jscomp/test/argv_test.js index d324689acb..727bfd8154 100644 --- a/jscomp/test/argv_test.js +++ b/jscomp/test/argv_test.js @@ -50,29 +50,27 @@ Arg.parse_argv(undefined, [ ], arg_spec, anno_fun, usage_msg); if (compile.contents !== true) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "argv_test.res", - 14, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "argv_test.res", + 14, + 2 + ], + Error: new Error() + }; } if (test.contents !== false) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "argv_test.res", - 15, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "argv_test.res", + 15, + 2 + ], + Error: new Error() + }; } exports.anno_fun = anno_fun; diff --git a/jscomp/test/arith_parser.js b/jscomp/test/arith_parser.js index 7520e20b28..a7e951781d 100644 --- a/jscomp/test/arith_parser.js +++ b/jscomp/test/arith_parser.js @@ -140,12 +140,11 @@ let yynames_block = "\ let yyact = [ param => { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "parser" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "parser", + Error: new Error() + }; }, __caml_parser_env => Parsing.peek_val(__caml_parser_env, 1), __caml_parser_env => { @@ -207,12 +206,11 @@ let yyact = [ }, __caml_parser_env => Parsing.peek_val(__caml_parser_env, 1), __caml_parser_env => { - throw new Error(Parsing.YYexit, { - cause: { - RE_EXN_ID: Parsing.YYexit, - _1: Parsing.peek_val(__caml_parser_env, 0) - } - }); + throw { + RE_EXN_ID: Parsing.YYexit, + _1: Parsing.peek_val(__caml_parser_env, 0), + Error: new Error() + }; } ]; diff --git a/jscomp/test/arity_infer.js b/jscomp/test/arity_infer.js index 18da9fe57b..0e7fd13815 100644 --- a/jscomp/test/arity_infer.js +++ b/jscomp/test/arity_infer.js @@ -7,21 +7,19 @@ function f0(x) { if (x > 3) { tmp = x => x + 1 | 0; } else { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } return tmp(3); } function f1(x) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; return undefined(x); } @@ -41,11 +39,10 @@ function f3(x) { tmp = x => x + 4 | 0; break; default: - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } return tmp(3); } diff --git a/jscomp/test/array_safe_get.js b/jscomp/test/array_safe_get.js index ce8a0437bf..8a669d3822 100644 --- a/jscomp/test/array_safe_get.js +++ b/jscomp/test/array_safe_get.js @@ -19,9 +19,7 @@ try { console.log(msg._1); y = 0; } else { - throw new Error(msg.RE_EXN_ID, { - cause: msg - }); + throw msg; } } diff --git a/jscomp/test/array_test.js b/jscomp/test/array_test.js index f84793a3f5..6a896b1c6b 100644 --- a/jscomp/test/array_test.js +++ b/jscomp/test/array_test.js @@ -20,11 +20,10 @@ function starts_with(xs, prefix, p) { try { for (let i = 0; i < len2; ++i) { if (!p(Caml_array.get(xs, i), Caml_array.get(prefix, i))) { - throw new Error(H, { - cause: { - RE_EXN_ID: H - } - }); + throw { + RE_EXN_ID: H, + Error: new Error() + }; } } @@ -34,9 +33,7 @@ function starts_with(xs, prefix, p) { if (exn.RE_EXN_ID === H) { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/bb.js b/jscomp/test/bb.js index ad4c90bb11..18f51ea211 100644 --- a/jscomp/test/bb.js +++ b/jscomp/test/bb.js @@ -21,16 +21,15 @@ function ff(x) { case "c" : return "c"; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bb.res", - 13, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bb.res", + 13, + 9 + ], + Error: new Error() + }; } } @@ -47,16 +46,15 @@ function test(x) { match = "c"; break; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bb.res", - 21, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bb.res", + 21, + 9 + ], + Error: new Error() + }; } if (match === "b") { return "b"; diff --git a/jscomp/test/bdd.js b/jscomp/test/bdd.js index a7b4f929b5..ac5c277765 100644 --- a/jscomp/test/bdd.js +++ b/jscomp/test/bdd.js @@ -67,27 +67,25 @@ function resize(newSize) { let n = bucket.hd; if (typeof n !== "object") { if (n === "One") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 60, - 13 - ] - } - }); - } - throw new Error("Assert_failure", { - cause: { + throw { RE_EXN_ID: "Assert_failure", _1: [ "bdd.res", 60, 13 - ] - } - }); + ], + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 60, + 13 + ], + Error: new Error() + }; } else { let ind = hashVal(getId(n._0), getId(n._3), n._1) & newSz_1; Caml_array.set(newArr, ind, { @@ -145,27 +143,25 @@ function mkNode(low, v, high) { let n = b.hd; if (typeof n !== "object") { if (n === "One") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 121, - 15 - ] - } - }); - } - throw new Error("Assert_failure", { - cause: { + throw { RE_EXN_ID: "Assert_failure", _1: [ "bdd.res", 121, 15 - ] - } - }); + ], + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 121, + 15 + ], + Error: new Error() + }; } else { if (v === n._1 && idl === getId(n._0) && idh === getId(n._3)) { return n; @@ -402,16 +398,15 @@ function main() { if (succeeded) { return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 301, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 301, + 2 + ], + Error: new Error() + }; } main(); diff --git a/jscomp/test/bench.js b/jscomp/test/bench.js index 8223ef2471..aa70b76e77 100644 --- a/jscomp/test/bench.js +++ b/jscomp/test/bench.js @@ -23,12 +23,11 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.init", + Error: new Error() + }; } let res = Caml_array.make(l, f$1(0)); for (let i = 1; i < l; ++i) { diff --git a/jscomp/test/big_polyvar_test.js b/jscomp/test/big_polyvar_test.js index 3cf61f097f..20c276f20f 100644 --- a/jscomp/test/big_polyvar_test.js +++ b/jscomp/test/big_polyvar_test.js @@ -25,7816 +25,7215 @@ function eq(x, y) { } if ("variant0" !== "variant0") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 314, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 314, + 0 + ], + Error: new Error() + }; } if ("variant1" !== "variant1") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 315, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 315, + 0 + ], + Error: new Error() + }; } if ("variant2" !== "variant2") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 316, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 316, + 0 + ], + Error: new Error() + }; } if ("variant3" !== "variant3") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 317, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 317, + 0 + ], + Error: new Error() + }; } if ("variant4" !== "variant4") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 318, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 318, + 0 + ], + Error: new Error() + }; } if ("variant5" !== "variant5") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 319, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 319, + 0 + ], + Error: new Error() + }; } if ("variant6" !== "variant6") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 320, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 320, + 0 + ], + Error: new Error() + }; } if ("variant7" !== "variant7") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 321, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 321, + 0 + ], + Error: new Error() + }; } if ("variant8" !== "variant8") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 322, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 322, + 0 + ], + Error: new Error() + }; } if ("variant9" !== "variant9") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 323, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 323, + 0 + ], + Error: new Error() + }; } if ("variant10" !== "variant10") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 324, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 324, + 0 + ], + Error: new Error() + }; } if ("variant11" !== "variant11") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 325, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 325, + 0 + ], + Error: new Error() + }; } if ("variant12" !== "variant12") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 326, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 326, + 0 + ], + Error: new Error() + }; } if ("variant13" !== "variant13") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 327, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 327, + 0 + ], + Error: new Error() + }; } if ("variant14" !== "variant14") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 328, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 328, + 0 + ], + Error: new Error() + }; } if ("variant15" !== "variant15") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 329, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 329, + 0 + ], + Error: new Error() + }; } if ("variant16" !== "variant16") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 330, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 330, + 0 + ], + Error: new Error() + }; } if ("variant17" !== "variant17") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 331, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 331, + 0 + ], + Error: new Error() + }; } if ("variant18" !== "variant18") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 332, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 332, + 0 + ], + Error: new Error() + }; } if ("variant19" !== "variant19") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 333, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 333, + 0 + ], + Error: new Error() + }; } if ("variant20" !== "variant20") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 334, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 334, + 0 + ], + Error: new Error() + }; } if ("variant21" !== "variant21") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 335, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 335, + 0 + ], + Error: new Error() + }; } if ("variant22" !== "variant22") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 336, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 336, + 0 + ], + Error: new Error() + }; } if ("variant23" !== "variant23") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 337, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 337, + 0 + ], + Error: new Error() + }; } if ("variant24" !== "variant24") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 338, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 338, + 0 + ], + Error: new Error() + }; } if ("variant25" !== "variant25") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 339, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 339, + 0 + ], + Error: new Error() + }; } if ("variant26" !== "variant26") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 340, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 340, + 0 + ], + Error: new Error() + }; } if ("variant27" !== "variant27") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 341, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 341, + 0 + ], + Error: new Error() + }; } if ("variant28" !== "variant28") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 342, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 342, + 0 + ], + Error: new Error() + }; } if ("variant29" !== "variant29") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 343, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 343, + 0 + ], + Error: new Error() + }; } if ("variant30" !== "variant30") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 344, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 344, + 0 + ], + Error: new Error() + }; } if ("variant31" !== "variant31") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 345, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 345, + 0 + ], + Error: new Error() + }; } if ("variant32" !== "variant32") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 346, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 346, + 0 + ], + Error: new Error() + }; } if ("variant33" !== "variant33") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 347, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 347, + 0 + ], + Error: new Error() + }; } if ("variant34" !== "variant34") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 348, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 348, + 0 + ], + Error: new Error() + }; } if ("variant35" !== "variant35") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 349, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 349, + 0 + ], + Error: new Error() + }; } if ("variant36" !== "variant36") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 350, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 350, + 0 + ], + Error: new Error() + }; } if ("variant37" !== "variant37") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 351, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 351, + 0 + ], + Error: new Error() + }; } if ("variant38" !== "variant38") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 352, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 352, + 0 + ], + Error: new Error() + }; } if ("variant39" !== "variant39") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 353, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 353, + 0 + ], + Error: new Error() + }; } if ("variant40" !== "variant40") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 354, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 354, + 0 + ], + Error: new Error() + }; } if ("variant41" !== "variant41") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 355, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 355, + 0 + ], + Error: new Error() + }; } if ("variant42" !== "variant42") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 356, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 356, + 0 + ], + Error: new Error() + }; } if ("variant43" !== "variant43") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 357, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 357, + 0 + ], + Error: new Error() + }; } if ("variant44" !== "variant44") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 358, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 358, + 0 + ], + Error: new Error() + }; } if ("variant45" !== "variant45") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 359, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 359, + 0 + ], + Error: new Error() + }; } if ("variant46" !== "variant46") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 360, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 360, + 0 + ], + Error: new Error() + }; } if ("variant47" !== "variant47") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 361, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 361, + 0 + ], + Error: new Error() + }; } if ("variant48" !== "variant48") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 362, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 362, + 0 + ], + Error: new Error() + }; } if ("variant49" !== "variant49") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 363, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 363, + 0 + ], + Error: new Error() + }; } if ("variant50" !== "variant50") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 364, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 364, + 0 + ], + Error: new Error() + }; } if ("variant51" !== "variant51") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 365, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 365, + 0 + ], + Error: new Error() + }; } if ("variant52" !== "variant52") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 366, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 366, + 0 + ], + Error: new Error() + }; } if ("variant53" !== "variant53") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 367, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 367, + 0 + ], + Error: new Error() + }; } if ("variant54" !== "variant54") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 368, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 368, + 0 + ], + Error: new Error() + }; } if ("variant55" !== "variant55") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 369, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 369, + 0 + ], + Error: new Error() + }; } if ("variant56" !== "variant56") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 370, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 370, + 0 + ], + Error: new Error() + }; } if ("variant57" !== "variant57") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 371, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 371, + 0 + ], + Error: new Error() + }; } if ("variant58" !== "variant58") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 372, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 372, + 0 + ], + Error: new Error() + }; } if ("variant59" !== "variant59") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 373, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 373, + 0 + ], + Error: new Error() + }; } if ("variant60" !== "variant60") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 374, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 374, + 0 + ], + Error: new Error() + }; } if ("variant61" !== "variant61") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 375, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 375, + 0 + ], + Error: new Error() + }; } if ("variant62" !== "variant62") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 376, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 376, + 0 + ], + Error: new Error() + }; } if ("variant63" !== "variant63") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 377, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 377, + 0 + ], + Error: new Error() + }; } if ("variant64" !== "variant64") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 378, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 378, + 0 + ], + Error: new Error() + }; } if ("variant65" !== "variant65") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 379, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 379, + 0 + ], + Error: new Error() + }; } if ("variant66" !== "variant66") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 380, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 380, + 0 + ], + Error: new Error() + }; } if ("variant67" !== "variant67") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 381, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 381, + 0 + ], + Error: new Error() + }; } if ("variant68" !== "variant68") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 382, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 382, + 0 + ], + Error: new Error() + }; } if ("variant69" !== "variant69") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 383, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 383, + 0 + ], + Error: new Error() + }; } if ("variant70" !== "variant70") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 384, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 384, + 0 + ], + Error: new Error() + }; } if ("variant71" !== "variant71") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 385, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 385, + 0 + ], + Error: new Error() + }; } if ("variant72" !== "variant72") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 386, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 386, + 0 + ], + Error: new Error() + }; } if ("variant73" !== "variant73") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 387, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 387, + 0 + ], + Error: new Error() + }; } if ("variant74" !== "variant74") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 388, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 388, + 0 + ], + Error: new Error() + }; } if ("variant75" !== "variant75") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 389, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 389, + 0 + ], + Error: new Error() + }; } if ("variant76" !== "variant76") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 390, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 390, + 0 + ], + Error: new Error() + }; } if ("variant77" !== "variant77") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 391, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 391, + 0 + ], + Error: new Error() + }; } if ("variant78" !== "variant78") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 392, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 392, + 0 + ], + Error: new Error() + }; } if ("variant79" !== "variant79") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 393, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 393, + 0 + ], + Error: new Error() + }; } if ("variant80" !== "variant80") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 394, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 394, + 0 + ], + Error: new Error() + }; } if ("variant81" !== "variant81") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 395, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 395, + 0 + ], + Error: new Error() + }; } if ("variant82" !== "variant82") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 396, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 396, + 0 + ], + Error: new Error() + }; } if ("variant83" !== "variant83") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 397, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 397, + 0 + ], + Error: new Error() + }; } if ("variant84" !== "variant84") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 398, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 398, + 0 + ], + Error: new Error() + }; } if ("variant85" !== "variant85") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 399, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 399, + 0 + ], + Error: new Error() + }; } if ("variant86" !== "variant86") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 400, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 400, + 0 + ], + Error: new Error() + }; } if ("variant87" !== "variant87") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 401, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 401, + 0 + ], + Error: new Error() + }; } if ("variant88" !== "variant88") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 402, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 402, + 0 + ], + Error: new Error() + }; } if ("variant89" !== "variant89") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 403, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 403, + 0 + ], + Error: new Error() + }; } if ("variant90" !== "variant90") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 404, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 404, + 0 + ], + Error: new Error() + }; } if ("variant91" !== "variant91") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 405, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 405, + 0 + ], + Error: new Error() + }; } if ("variant92" !== "variant92") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 406, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 406, + 0 + ], + Error: new Error() + }; } if ("variant93" !== "variant93") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 407, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 407, + 0 + ], + Error: new Error() + }; } if ("variant94" !== "variant94") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 408, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 408, + 0 + ], + Error: new Error() + }; } if ("variant95" !== "variant95") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 409, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 409, + 0 + ], + Error: new Error() + }; } if ("variant96" !== "variant96") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 410, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 410, + 0 + ], + Error: new Error() + }; } if ("variant97" !== "variant97") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 411, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 411, + 0 + ], + Error: new Error() + }; } if ("variant98" !== "variant98") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 412, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 412, + 0 + ], + Error: new Error() + }; } if ("variant99" !== "variant99") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 413, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 413, + 0 + ], + Error: new Error() + }; } if ("variant100" !== "variant100") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 414, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 414, + 0 + ], + Error: new Error() + }; } if ("variant101" !== "variant101") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 415, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 415, + 0 + ], + Error: new Error() + }; } if ("variant102" !== "variant102") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 416, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 416, + 0 + ], + Error: new Error() + }; } if ("variant103" !== "variant103") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 417, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 417, + 0 + ], + Error: new Error() + }; } if ("variant104" !== "variant104") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 418, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 418, + 0 + ], + Error: new Error() + }; } if ("variant105" !== "variant105") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 419, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 419, + 0 + ], + Error: new Error() + }; } if ("variant106" !== "variant106") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 420, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 420, + 0 + ], + Error: new Error() + }; } if ("variant107" !== "variant107") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 421, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 421, + 0 + ], + Error: new Error() + }; } if ("variant108" !== "variant108") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 422, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 422, + 0 + ], + Error: new Error() + }; } if ("variant109" !== "variant109") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 423, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 423, + 0 + ], + Error: new Error() + }; } if ("variant110" !== "variant110") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 424, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 424, + 0 + ], + Error: new Error() + }; } if ("variant111" !== "variant111") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 425, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 425, + 0 + ], + Error: new Error() + }; } if ("variant112" !== "variant112") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 426, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 426, + 0 + ], + Error: new Error() + }; } if ("variant113" !== "variant113") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 427, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 427, + 0 + ], + Error: new Error() + }; } if ("variant114" !== "variant114") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 428, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 428, + 0 + ], + Error: new Error() + }; } if ("variant115" !== "variant115") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 429, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 429, + 0 + ], + Error: new Error() + }; } if ("variant116" !== "variant116") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 430, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 430, + 0 + ], + Error: new Error() + }; } if ("variant117" !== "variant117") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 431, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 431, + 0 + ], + Error: new Error() + }; } if ("variant118" !== "variant118") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 432, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 432, + 0 + ], + Error: new Error() + }; } if ("variant119" !== "variant119") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 433, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 433, + 0 + ], + Error: new Error() + }; } if ("variant120" !== "variant120") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 434, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 434, + 0 + ], + Error: new Error() + }; } if ("variant121" !== "variant121") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 435, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 435, + 0 + ], + Error: new Error() + }; } if ("variant122" !== "variant122") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 436, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 436, + 0 + ], + Error: new Error() + }; } if ("variant123" !== "variant123") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 437, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 437, + 0 + ], + Error: new Error() + }; } if ("variant124" !== "variant124") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 438, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 438, + 0 + ], + Error: new Error() + }; } if ("variant125" !== "variant125") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 439, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 439, + 0 + ], + Error: new Error() + }; } if ("variant126" !== "variant126") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 440, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 440, + 0 + ], + Error: new Error() + }; } if ("variant127" !== "variant127") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 441, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 441, + 0 + ], + Error: new Error() + }; } if ("variant128" !== "variant128") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 442, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 442, + 0 + ], + Error: new Error() + }; } if ("variant129" !== "variant129") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 443, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 443, + 0 + ], + Error: new Error() + }; } if ("variant130" !== "variant130") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 444, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 444, + 0 + ], + Error: new Error() + }; } if ("variant131" !== "variant131") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 445, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 445, + 0 + ], + Error: new Error() + }; } if ("variant132" !== "variant132") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 446, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 446, + 0 + ], + Error: new Error() + }; } if ("variant133" !== "variant133") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 447, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 447, + 0 + ], + Error: new Error() + }; } if ("variant134" !== "variant134") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 448, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 448, + 0 + ], + Error: new Error() + }; } if ("variant135" !== "variant135") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 449, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 449, + 0 + ], + Error: new Error() + }; } if ("variant136" !== "variant136") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 450, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 450, + 0 + ], + Error: new Error() + }; } if ("variant137" !== "variant137") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 451, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 451, + 0 + ], + Error: new Error() + }; } if ("variant138" !== "variant138") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 452, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 452, + 0 + ], + Error: new Error() + }; } if ("variant139" !== "variant139") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 453, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 453, + 0 + ], + Error: new Error() + }; } if ("variant140" !== "variant140") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 454, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 454, + 0 + ], + Error: new Error() + }; } if ("variant141" !== "variant141") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 455, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 455, + 0 + ], + Error: new Error() + }; } if ("variant142" !== "variant142") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 456, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 456, + 0 + ], + Error: new Error() + }; } if ("variant143" !== "variant143") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 457, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 457, + 0 + ], + Error: new Error() + }; } if ("variant144" !== "variant144") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 458, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 458, + 0 + ], + Error: new Error() + }; } if ("variant145" !== "variant145") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 459, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 459, + 0 + ], + Error: new Error() + }; } if ("variant146" !== "variant146") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 460, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 460, + 0 + ], + Error: new Error() + }; } if ("variant147" !== "variant147") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 461, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 461, + 0 + ], + Error: new Error() + }; } if ("variant148" !== "variant148") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 462, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 462, + 0 + ], + Error: new Error() + }; } if ("variant149" !== "variant149") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 463, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 463, + 0 + ], + Error: new Error() + }; } if ("variant150" !== "variant150") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 464, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 464, + 0 + ], + Error: new Error() + }; } if ("variant151" !== "variant151") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 465, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 465, + 0 + ], + Error: new Error() + }; } if ("variant152" !== "variant152") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 466, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 466, + 0 + ], + Error: new Error() + }; } if ("variant153" !== "variant153") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 467, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 467, + 0 + ], + Error: new Error() + }; } if ("variant154" !== "variant154") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 468, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 468, + 0 + ], + Error: new Error() + }; } if ("variant155" !== "variant155") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 469, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 469, + 0 + ], + Error: new Error() + }; } if ("variant156" !== "variant156") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 470, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 470, + 0 + ], + Error: new Error() + }; } if ("variant157" !== "variant157") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 471, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 471, + 0 + ], + Error: new Error() + }; } if ("variant158" !== "variant158") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 472, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 472, + 0 + ], + Error: new Error() + }; } if ("variant159" !== "variant159") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 473, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 473, + 0 + ], + Error: new Error() + }; } if ("variant160" !== "variant160") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 474, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 474, + 0 + ], + Error: new Error() + }; } if ("variant161" !== "variant161") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 475, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 475, + 0 + ], + Error: new Error() + }; } if ("variant162" !== "variant162") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 476, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 476, + 0 + ], + Error: new Error() + }; } if ("variant163" !== "variant163") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 477, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 477, + 0 + ], + Error: new Error() + }; } if ("variant164" !== "variant164") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 478, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 478, + 0 + ], + Error: new Error() + }; } if ("variant165" !== "variant165") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 479, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 479, + 0 + ], + Error: new Error() + }; } if ("variant166" !== "variant166") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 480, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 480, + 0 + ], + Error: new Error() + }; } if ("variant167" !== "variant167") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 481, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 481, + 0 + ], + Error: new Error() + }; } if ("variant168" !== "variant168") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 482, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 482, + 0 + ], + Error: new Error() + }; } if ("variant169" !== "variant169") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 483, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 483, + 0 + ], + Error: new Error() + }; } if ("variant170" !== "variant170") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 484, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 484, + 0 + ], + Error: new Error() + }; } if ("variant171" !== "variant171") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 485, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 485, + 0 + ], + Error: new Error() + }; } if ("variant172" !== "variant172") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 486, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 486, + 0 + ], + Error: new Error() + }; } if ("variant173" !== "variant173") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 487, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 487, + 0 + ], + Error: new Error() + }; } if ("variant174" !== "variant174") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 488, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 488, + 0 + ], + Error: new Error() + }; } if ("variant175" !== "variant175") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 489, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 489, + 0 + ], + Error: new Error() + }; } if ("variant176" !== "variant176") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 490, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 490, + 0 + ], + Error: new Error() + }; } if ("variant177" !== "variant177") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 491, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 491, + 0 + ], + Error: new Error() + }; } if ("variant178" !== "variant178") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 492, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 492, + 0 + ], + Error: new Error() + }; } if ("variant179" !== "variant179") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 493, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 493, + 0 + ], + Error: new Error() + }; } if ("variant180" !== "variant180") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 494, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 494, + 0 + ], + Error: new Error() + }; } if ("variant181" !== "variant181") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 495, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 495, + 0 + ], + Error: new Error() + }; } if ("variant182" !== "variant182") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 496, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 496, + 0 + ], + Error: new Error() + }; } if ("variant183" !== "variant183") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 497, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 497, + 0 + ], + Error: new Error() + }; } if ("variant184" !== "variant184") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 498, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 498, + 0 + ], + Error: new Error() + }; } if ("variant185" !== "variant185") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 499, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 499, + 0 + ], + Error: new Error() + }; } if ("variant186" !== "variant186") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 500, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 500, + 0 + ], + Error: new Error() + }; } if ("variant187" !== "variant187") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 501, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 501, + 0 + ], + Error: new Error() + }; } if ("variant188" !== "variant188") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 502, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 502, + 0 + ], + Error: new Error() + }; } if ("variant189" !== "variant189") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 503, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 503, + 0 + ], + Error: new Error() + }; } if ("variant190" !== "variant190") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 504, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 504, + 0 + ], + Error: new Error() + }; } if ("variant191" !== "variant191") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 505, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 505, + 0 + ], + Error: new Error() + }; } if ("variant192" !== "variant192") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 506, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 506, + 0 + ], + Error: new Error() + }; } if ("variant193" !== "variant193") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 507, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 507, + 0 + ], + Error: new Error() + }; } if ("variant194" !== "variant194") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 508, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 508, + 0 + ], + Error: new Error() + }; } if ("variant195" !== "variant195") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 509, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 509, + 0 + ], + Error: new Error() + }; } if ("variant196" !== "variant196") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 510, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 510, + 0 + ], + Error: new Error() + }; } if ("variant197" !== "variant197") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 511, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 511, + 0 + ], + Error: new Error() + }; } if ("variant198" !== "variant198") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 512, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 512, + 0 + ], + Error: new Error() + }; } if ("variant199" !== "variant199") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 513, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 513, + 0 + ], + Error: new Error() + }; } if ("variant200" !== "variant200") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 514, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 514, + 0 + ], + Error: new Error() + }; } if ("variant201" !== "variant201") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 515, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 515, + 0 + ], + Error: new Error() + }; } if ("variant202" !== "variant202") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 516, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 516, + 0 + ], + Error: new Error() + }; } if ("variant203" !== "variant203") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 517, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 517, + 0 + ], + Error: new Error() + }; } if ("variant204" !== "variant204") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 518, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 518, + 0 + ], + Error: new Error() + }; } if ("variant205" !== "variant205") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 519, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 519, + 0 + ], + Error: new Error() + }; } if ("variant206" !== "variant206") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 520, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 520, + 0 + ], + Error: new Error() + }; } if ("variant207" !== "variant207") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 521, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 521, + 0 + ], + Error: new Error() + }; } if ("variant208" !== "variant208") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 522, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 522, + 0 + ], + Error: new Error() + }; } if ("variant209" !== "variant209") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 523, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 523, + 0 + ], + Error: new Error() + }; } if ("variant210" !== "variant210") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 524, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 524, + 0 + ], + Error: new Error() + }; } if ("variant211" !== "variant211") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 525, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 525, + 0 + ], + Error: new Error() + }; } if ("variant212" !== "variant212") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 526, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 526, + 0 + ], + Error: new Error() + }; } if ("variant213" !== "variant213") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 527, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 527, + 0 + ], + Error: new Error() + }; } if ("variant214" !== "variant214") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 528, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 528, + 0 + ], + Error: new Error() + }; } if ("variant215" !== "variant215") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 529, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 529, + 0 + ], + Error: new Error() + }; } if ("variant216" !== "variant216") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 530, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 530, + 0 + ], + Error: new Error() + }; } if ("variant217" !== "variant217") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 531, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 531, + 0 + ], + Error: new Error() + }; } if ("variant218" !== "variant218") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 532, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 532, + 0 + ], + Error: new Error() + }; } if ("variant219" !== "variant219") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 533, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 533, + 0 + ], + Error: new Error() + }; } if ("variant220" !== "variant220") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 534, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 534, + 0 + ], + Error: new Error() + }; } if ("variant221" !== "variant221") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 535, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 535, + 0 + ], + Error: new Error() + }; } if ("variant222" !== "variant222") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 536, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 536, + 0 + ], + Error: new Error() + }; } if ("variant223" !== "variant223") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 537, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 537, + 0 + ], + Error: new Error() + }; } if ("variant224" !== "variant224") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 538, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 538, + 0 + ], + Error: new Error() + }; } if ("variant225" !== "variant225") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 539, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 539, + 0 + ], + Error: new Error() + }; } if ("variant226" !== "variant226") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 540, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 540, + 0 + ], + Error: new Error() + }; } if ("variant227" !== "variant227") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 541, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 541, + 0 + ], + Error: new Error() + }; } if ("variant228" !== "variant228") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 542, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 542, + 0 + ], + Error: new Error() + }; } if ("variant229" !== "variant229") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 543, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 543, + 0 + ], + Error: new Error() + }; } if ("variant230" !== "variant230") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 544, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 544, + 0 + ], + Error: new Error() + }; } if ("variant231" !== "variant231") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 545, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 545, + 0 + ], + Error: new Error() + }; } if ("variant232" !== "variant232") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 546, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 546, + 0 + ], + Error: new Error() + }; } if ("variant233" !== "variant233") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 547, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 547, + 0 + ], + Error: new Error() + }; } if ("variant234" !== "variant234") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 548, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 548, + 0 + ], + Error: new Error() + }; } if ("variant235" !== "variant235") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 549, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 549, + 0 + ], + Error: new Error() + }; } if ("variant236" !== "variant236") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 550, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 550, + 0 + ], + Error: new Error() + }; } if ("variant237" !== "variant237") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 551, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 551, + 0 + ], + Error: new Error() + }; } if ("variant238" !== "variant238") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 552, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 552, + 0 + ], + Error: new Error() + }; } if ("variant239" !== "variant239") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 553, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 553, + 0 + ], + Error: new Error() + }; } if ("variant240" !== "variant240") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 554, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 554, + 0 + ], + Error: new Error() + }; } if ("variant241" !== "variant241") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 555, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 555, + 0 + ], + Error: new Error() + }; } if ("variant242" !== "variant242") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 556, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 556, + 0 + ], + Error: new Error() + }; } if ("variant243" !== "variant243") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 557, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 557, + 0 + ], + Error: new Error() + }; } if ("variant244" !== "variant244") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 558, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 558, + 0 + ], + Error: new Error() + }; } if ("variant245" !== "variant245") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 559, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 559, + 0 + ], + Error: new Error() + }; } if ("variant246" !== "variant246") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 560, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 560, + 0 + ], + Error: new Error() + }; } if ("variant247" !== "variant247") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 561, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 561, + 0 + ], + Error: new Error() + }; } if ("variant248" !== "variant248") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 562, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 562, + 0 + ], + Error: new Error() + }; } if ("variant249" !== "variant249") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 563, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 563, + 0 + ], + Error: new Error() + }; } if ("variant250" !== "variant250") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 564, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 564, + 0 + ], + Error: new Error() + }; } if ("variant251" !== "variant251") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 565, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 565, + 0 + ], + Error: new Error() + }; } if ("variant252" !== "variant252") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 566, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 566, + 0 + ], + Error: new Error() + }; } if ("variant253" !== "variant253") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 567, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 567, + 0 + ], + Error: new Error() + }; } if ("variant254" !== "variant254") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 568, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 568, + 0 + ], + Error: new Error() + }; } if ("variant255" !== "variant255") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 569, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 569, + 0 + ], + Error: new Error() + }; } if ("variant256" !== "variant256") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 570, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 570, + 0 + ], + Error: new Error() + }; } if ("variant257" !== "variant257") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 571, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 571, + 0 + ], + Error: new Error() + }; } if ("variant258" !== "variant258") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 572, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 572, + 0 + ], + Error: new Error() + }; } if ("variant259" !== "variant259") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 573, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 573, + 0 + ], + Error: new Error() + }; } if ("variant260" !== "variant260") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 574, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 574, + 0 + ], + Error: new Error() + }; } if ("variant261" !== "variant261") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 575, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 575, + 0 + ], + Error: new Error() + }; } if ("variant262" !== "variant262") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 576, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 576, + 0 + ], + Error: new Error() + }; } if ("variant263" !== "variant263") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 577, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 577, + 0 + ], + Error: new Error() + }; } if ("variant264" !== "variant264") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 578, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 578, + 0 + ], + Error: new Error() + }; } if ("variant265" !== "variant265") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 579, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 579, + 0 + ], + Error: new Error() + }; } if ("variant266" !== "variant266") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 580, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 580, + 0 + ], + Error: new Error() + }; } if ("variant267" !== "variant267") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 581, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 581, + 0 + ], + Error: new Error() + }; } if ("variant268" !== "variant268") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 582, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 582, + 0 + ], + Error: new Error() + }; } if ("variant269" !== "variant269") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 583, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 583, + 0 + ], + Error: new Error() + }; } if ("variant270" !== "variant270") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 584, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 584, + 0 + ], + Error: new Error() + }; } if ("variant271" !== "variant271") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 585, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 585, + 0 + ], + Error: new Error() + }; } if ("variant272" !== "variant272") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 586, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 586, + 0 + ], + Error: new Error() + }; } if ("variant273" !== "variant273") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 587, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 587, + 0 + ], + Error: new Error() + }; } if ("variant274" !== "variant274") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 588, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 588, + 0 + ], + Error: new Error() + }; } if ("variant275" !== "variant275") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 589, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 589, + 0 + ], + Error: new Error() + }; } if ("variant276" !== "variant276") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 590, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 590, + 0 + ], + Error: new Error() + }; } if ("variant277" !== "variant277") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 591, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 591, + 0 + ], + Error: new Error() + }; } if ("variant278" !== "variant278") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 592, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 592, + 0 + ], + Error: new Error() + }; } if ("variant279" !== "variant279") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 593, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 593, + 0 + ], + Error: new Error() + }; } if ("variant280" !== "variant280") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 594, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 594, + 0 + ], + Error: new Error() + }; } if ("variant281" !== "variant281") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 595, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 595, + 0 + ], + Error: new Error() + }; } if ("variant282" !== "variant282") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 596, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 596, + 0 + ], + Error: new Error() + }; } if ("variant283" !== "variant283") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 597, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 597, + 0 + ], + Error: new Error() + }; } if ("variant284" !== "variant284") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 598, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 598, + 0 + ], + Error: new Error() + }; } if ("variant285" !== "variant285") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 599, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 599, + 0 + ], + Error: new Error() + }; } if ("variant286" !== "variant286") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 600, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 600, + 0 + ], + Error: new Error() + }; } if ("variant287" !== "variant287") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 601, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 601, + 0 + ], + Error: new Error() + }; } if ("variant288" !== "variant288") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 602, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 602, + 0 + ], + Error: new Error() + }; } if ("variant289" !== "variant289") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 603, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 603, + 0 + ], + Error: new Error() + }; } if ("variant290" !== "variant290") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 604, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 604, + 0 + ], + Error: new Error() + }; } if ("variant291" !== "variant291") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 605, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 605, + 0 + ], + Error: new Error() + }; } if ("variant292" !== "variant292") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 606, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 606, + 0 + ], + Error: new Error() + }; } if ("variant293" !== "variant293") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 607, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 607, + 0 + ], + Error: new Error() + }; } if ("variant294" !== "variant294") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 608, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 608, + 0 + ], + Error: new Error() + }; } if ("variant295" !== "variant295") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 609, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 609, + 0 + ], + Error: new Error() + }; } if ("variant296" !== "variant296") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 610, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 610, + 0 + ], + Error: new Error() + }; } if ("variant297" !== "variant297") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 611, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 611, + 0 + ], + Error: new Error() + }; } if ("variant298" !== "variant298") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 612, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 612, + 0 + ], + Error: new Error() + }; } if ("variant299" !== "variant299") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 613, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 613, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant0"), "variant0")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 614, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 614, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant1"), "variant1")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 615, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 615, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant2"), "variant2")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 616, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 616, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant3"), "variant3")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 617, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 617, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant4"), "variant4")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 618, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 618, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant5"), "variant5")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 619, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 619, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant6"), "variant6")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 620, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 620, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant7"), "variant7")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 621, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 621, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant8"), "variant8")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 622, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 622, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant9"), "variant9")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 623, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 623, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant10"), "variant10")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 624, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 624, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant11"), "variant11")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 625, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 625, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant12"), "variant12")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 626, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 626, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant13"), "variant13")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 627, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 627, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant14"), "variant14")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 628, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 628, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant15"), "variant15")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 629, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 629, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant16"), "variant16")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 630, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 630, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant17"), "variant17")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 631, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 631, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant18"), "variant18")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 632, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 632, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant19"), "variant19")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 633, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 633, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant20"), "variant20")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 634, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 634, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant21"), "variant21")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 635, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 635, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant22"), "variant22")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 636, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 636, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant23"), "variant23")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 637, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 637, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant24"), "variant24")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 638, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 638, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant25"), "variant25")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 639, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 639, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant26"), "variant26")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 640, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 640, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant27"), "variant27")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 641, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 641, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant28"), "variant28")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 642, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 642, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant29"), "variant29")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 643, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 643, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant30"), "variant30")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 644, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 644, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant31"), "variant31")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 645, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 645, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant32"), "variant32")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 646, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 646, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant33"), "variant33")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 647, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 647, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant34"), "variant34")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 648, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 648, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant35"), "variant35")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 649, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 649, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant36"), "variant36")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 650, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 650, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant37"), "variant37")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 651, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 651, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant38"), "variant38")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 652, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 652, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant39"), "variant39")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 653, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 653, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant40"), "variant40")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 654, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 654, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant41"), "variant41")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 655, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 655, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant42"), "variant42")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 656, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 656, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant43"), "variant43")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 657, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 657, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant44"), "variant44")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 658, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 658, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant45"), "variant45")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 659, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 659, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant46"), "variant46")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 660, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 660, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant47"), "variant47")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 661, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 661, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant48"), "variant48")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 662, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 662, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant49"), "variant49")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 663, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 663, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant50"), "variant50")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 664, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 664, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant51"), "variant51")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 665, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 665, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant52"), "variant52")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 666, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 666, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant53"), "variant53")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 667, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 667, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant54"), "variant54")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 668, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 668, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant55"), "variant55")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 669, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 669, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant56"), "variant56")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 670, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 670, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant57"), "variant57")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 671, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 671, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant58"), "variant58")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 672, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 672, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant59"), "variant59")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 673, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 673, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant60"), "variant60")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 674, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 674, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant61"), "variant61")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 675, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 675, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant62"), "variant62")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 676, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 676, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant63"), "variant63")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 677, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 677, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant64"), "variant64")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 678, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 678, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant65"), "variant65")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 679, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 679, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant66"), "variant66")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 680, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 680, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant67"), "variant67")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 681, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 681, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant68"), "variant68")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 682, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 682, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant69"), "variant69")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 683, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 683, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant70"), "variant70")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 684, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 684, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant71"), "variant71")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 685, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 685, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant72"), "variant72")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 686, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 686, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant73"), "variant73")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 687, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 687, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant74"), "variant74")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 688, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 688, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant75"), "variant75")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 689, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 689, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant76"), "variant76")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 690, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 690, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant77"), "variant77")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 691, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 691, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant78"), "variant78")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 692, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 692, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant79"), "variant79")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 693, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 693, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant80"), "variant80")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 694, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 694, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant81"), "variant81")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 695, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 695, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant82"), "variant82")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 696, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 696, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant83"), "variant83")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 697, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 697, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant84"), "variant84")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 698, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 698, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant85"), "variant85")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 699, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 699, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant86"), "variant86")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 700, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 700, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant87"), "variant87")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 701, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 701, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant88"), "variant88")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 702, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 702, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant89"), "variant89")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 703, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 703, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant90"), "variant90")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 704, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 704, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant91"), "variant91")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 705, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 705, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant92"), "variant92")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 706, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 706, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant93"), "variant93")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 707, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 707, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant94"), "variant94")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 708, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 708, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant95"), "variant95")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 709, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 709, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant96"), "variant96")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 710, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 710, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant97"), "variant97")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 711, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 711, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant98"), "variant98")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 712, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 712, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant99"), "variant99")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 713, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 713, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant100"), "variant100")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 714, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 714, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant101"), "variant101")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 715, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 715, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant102"), "variant102")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 716, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 716, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant103"), "variant103")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 717, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 717, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant104"), "variant104")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 718, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 718, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant105"), "variant105")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 719, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 719, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant106"), "variant106")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 720, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 720, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant107"), "variant107")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 721, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 721, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant108"), "variant108")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 722, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 722, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant109"), "variant109")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 723, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 723, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant110"), "variant110")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 724, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 724, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant111"), "variant111")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 725, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 725, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant112"), "variant112")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 726, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 726, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant113"), "variant113")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 727, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 727, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant114"), "variant114")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 728, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 728, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant115"), "variant115")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 729, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 729, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant116"), "variant116")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 730, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 730, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant117"), "variant117")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 731, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 731, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant118"), "variant118")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 732, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 732, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant119"), "variant119")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 733, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 733, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant120"), "variant120")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 734, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 734, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant121"), "variant121")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 735, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 735, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant122"), "variant122")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 736, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 736, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant123"), "variant123")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 737, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 737, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant124"), "variant124")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 738, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 738, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant125"), "variant125")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 739, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 739, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant126"), "variant126")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 740, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 740, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant127"), "variant127")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 741, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 741, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant128"), "variant128")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 742, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 742, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant129"), "variant129")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 743, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 743, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant130"), "variant130")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 744, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 744, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant131"), "variant131")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 745, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 745, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant132"), "variant132")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 746, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 746, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant133"), "variant133")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 747, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 747, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant134"), "variant134")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 748, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 748, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant135"), "variant135")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 749, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 749, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant136"), "variant136")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 750, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 750, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant137"), "variant137")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 751, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 751, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant138"), "variant138")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 752, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 752, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant139"), "variant139")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 753, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 753, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant140"), "variant140")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 754, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 754, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant141"), "variant141")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 755, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 755, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant142"), "variant142")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 756, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 756, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant143"), "variant143")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 757, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 757, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant144"), "variant144")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 758, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 758, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant145"), "variant145")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 759, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 759, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant146"), "variant146")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 760, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 760, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant147"), "variant147")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 761, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 761, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant148"), "variant148")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 762, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 762, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant149"), "variant149")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 763, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 763, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant150"), "variant150")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 764, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 764, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant151"), "variant151")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 765, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 765, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant152"), "variant152")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 766, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 766, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant153"), "variant153")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 767, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 767, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant154"), "variant154")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 768, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 768, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant155"), "variant155")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 769, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 769, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant156"), "variant156")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 770, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 770, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant157"), "variant157")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 771, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 771, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant158"), "variant158")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 772, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 772, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant159"), "variant159")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 773, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 773, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant160"), "variant160")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 774, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 774, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant161"), "variant161")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 775, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 775, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant162"), "variant162")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 776, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 776, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant163"), "variant163")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 777, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 777, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant164"), "variant164")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 778, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 778, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant165"), "variant165")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 779, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 779, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant166"), "variant166")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 780, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 780, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant167"), "variant167")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 781, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 781, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant168"), "variant168")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 782, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 782, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant169"), "variant169")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 783, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 783, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant170"), "variant170")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 784, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 784, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant171"), "variant171")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 785, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 785, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant172"), "variant172")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 786, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 786, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant173"), "variant173")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 787, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 787, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant174"), "variant174")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 788, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 788, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant175"), "variant175")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 789, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 789, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant176"), "variant176")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 790, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 790, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant177"), "variant177")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 791, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 791, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant178"), "variant178")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 792, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 792, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant179"), "variant179")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 793, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 793, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant180"), "variant180")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 794, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 794, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant181"), "variant181")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 795, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 795, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant182"), "variant182")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 796, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 796, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant183"), "variant183")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 797, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 797, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant184"), "variant184")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 798, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 798, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant185"), "variant185")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 799, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 799, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant186"), "variant186")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 800, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 800, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant187"), "variant187")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 801, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 801, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant188"), "variant188")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 802, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 802, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant189"), "variant189")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 803, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 803, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant190"), "variant190")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 804, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 804, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant191"), "variant191")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 805, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 805, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant192"), "variant192")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 806, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 806, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant193"), "variant193")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 807, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 807, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant194"), "variant194")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 808, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 808, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant195"), "variant195")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 809, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 809, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant196"), "variant196")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 810, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 810, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant197"), "variant197")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 811, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 811, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant198"), "variant198")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 812, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 812, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant199"), "variant199")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 813, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 813, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant200"), "variant200")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 814, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 814, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant201"), "variant201")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 815, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 815, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant202"), "variant202")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 816, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 816, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant203"), "variant203")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 817, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 817, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant204"), "variant204")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 818, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 818, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant205"), "variant205")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 819, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 819, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant206"), "variant206")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 820, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 820, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant207"), "variant207")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 821, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 821, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant208"), "variant208")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 822, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 822, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant209"), "variant209")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 823, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 823, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant210"), "variant210")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 824, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 824, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant211"), "variant211")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 825, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 825, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant212"), "variant212")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 826, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 826, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant213"), "variant213")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 827, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 827, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant214"), "variant214")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 828, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 828, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant215"), "variant215")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 829, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 829, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant216"), "variant216")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 830, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 830, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant217"), "variant217")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 831, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 831, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant218"), "variant218")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 832, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 832, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant219"), "variant219")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 833, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 833, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant220"), "variant220")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 834, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 834, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant221"), "variant221")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 835, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 835, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant222"), "variant222")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 836, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 836, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant223"), "variant223")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 837, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 837, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant224"), "variant224")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 838, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 838, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant225"), "variant225")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 839, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 839, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant226"), "variant226")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 840, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 840, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant227"), "variant227")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 841, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 841, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant228"), "variant228")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 842, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 842, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant229"), "variant229")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 843, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 843, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant230"), "variant230")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 844, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 844, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant231"), "variant231")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 845, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 845, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant232"), "variant232")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 846, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 846, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant233"), "variant233")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 847, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 847, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant234"), "variant234")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 848, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 848, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant235"), "variant235")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 849, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 849, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant236"), "variant236")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 850, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 850, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant237"), "variant237")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 851, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 851, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant238"), "variant238")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 852, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 852, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant239"), "variant239")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 853, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 853, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant240"), "variant240")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 854, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 854, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant241"), "variant241")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 855, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 855, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant242"), "variant242")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 856, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 856, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant243"), "variant243")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 857, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 857, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant244"), "variant244")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 858, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 858, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant245"), "variant245")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 859, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 859, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant246"), "variant246")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 860, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 860, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant247"), "variant247")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 861, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 861, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant248"), "variant248")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 862, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 862, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant249"), "variant249")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 863, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 863, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant250"), "variant250")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 864, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 864, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant251"), "variant251")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 865, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 865, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant252"), "variant252")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 866, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 866, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant253"), "variant253")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 867, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 867, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant254"), "variant254")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 868, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 868, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant255"), "variant255")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 869, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 869, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant256"), "variant256")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 870, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 870, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant257"), "variant257")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 871, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 871, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant258"), "variant258")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 872, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 872, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant259"), "variant259")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 873, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 873, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant260"), "variant260")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 874, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 874, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant261"), "variant261")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 875, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 875, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant262"), "variant262")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 876, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 876, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant263"), "variant263")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 877, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 877, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant264"), "variant264")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 878, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 878, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant265"), "variant265")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 879, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 879, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant266"), "variant266")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 880, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 880, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant267"), "variant267")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 881, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 881, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant268"), "variant268")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 882, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 882, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant269"), "variant269")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 883, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 883, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant270"), "variant270")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 884, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 884, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant271"), "variant271")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 885, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 885, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant272"), "variant272")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 886, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 886, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant273"), "variant273")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 887, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 887, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant274"), "variant274")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 888, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 888, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant275"), "variant275")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 889, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 889, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant276"), "variant276")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 890, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 890, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant277"), "variant277")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 891, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 891, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant278"), "variant278")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 892, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 892, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant279"), "variant279")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 893, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 893, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant280"), "variant280")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 894, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 894, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant281"), "variant281")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 895, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 895, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant282"), "variant282")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 896, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 896, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant283"), "variant283")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 897, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 897, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant284"), "variant284")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 898, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 898, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant285"), "variant285")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 899, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 899, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant286"), "variant286")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 900, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 900, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant287"), "variant287")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 901, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 901, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant288"), "variant288")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 902, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 902, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant289"), "variant289")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 903, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 903, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant290"), "variant290")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 904, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 904, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant291"), "variant291")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 905, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 905, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant292"), "variant292")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 906, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 906, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant293"), "variant293")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 907, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 907, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant294"), "variant294")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 908, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 908, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant295"), "variant295")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 909, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 909, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant296"), "variant296")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 910, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 910, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant297"), "variant297")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 911, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 911, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant298"), "variant298")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 912, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 912, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("variant299"), "variant299")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 913, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 913, + 0 + ], + Error: new Error() + }; } if (!eq(tFromJs("xx"), undefined)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 914, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 914, + 0 + ], + Error: new Error() + }; } exports.tToJs = tToJs; diff --git a/jscomp/test/bs_array_test.js b/jscomp/test/bs_array_test.js index 610ef1fa8b..e27e892f58 100644 --- a/jscomp/test/bs_array_test.js +++ b/jscomp/test/bs_array_test.js @@ -122,16 +122,15 @@ let v$1 = [ ]; if (!Belt_Array.set(v$1, 0, 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_array_test.res", - 51, - 6 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 51, + 6 + ], + Error: new Error() + }; } b("File \"bs_array_test.res\", line 48, characters 4-11", Belt_Array.getExn(v$1, 0) === 0); @@ -142,16 +141,15 @@ let v$2 = [ ]; if (!Belt_Array.set(v$2, 1, 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_array_test.res", - 59, - 6 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 59, + 6 + ], + Error: new Error() + }; } b("File \"bs_array_test.res\", line 56, characters 4-11", Belt_Array.getExn(v$2, 1) === 0); @@ -254,16 +252,15 @@ function addone(x) { function makeMatrixExn(sx, sy, init) { if (!(sx >= 0 && sy >= 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_array_test.res", - 116, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 116, + 2 + ], + Error: new Error() + }; } let res = new Array(sx); for (let x = 0; x < sx; ++x) { diff --git a/jscomp/test/bs_queue_test.js b/jscomp/test/bs_queue_test.js index 23b344361b..203429cc14 100644 --- a/jscomp/test/bs_queue_test.js +++ b/jscomp/test/bs_queue_test.js @@ -43,45 +43,42 @@ let q = { }; if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), []) && q.length === 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 25, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 25, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 1), q)), [1]) && q.length === 1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 26, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 26, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 2), q)), [ 1, 2 ]) && q.length === 2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 27, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 27, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)), [ @@ -89,16 +86,15 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)) 2, 3 ]) && q.length === 3)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 28, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 28, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 4), q)), [ @@ -107,29 +103,27 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 4), q)) 3, 4 ]) && q.length === 4)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 29, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 29, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 30, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 30, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), [ @@ -137,110 +131,102 @@ if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), [ 3, 4 ]) && q.length === 3)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 31, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 31, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 32, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 32, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), [ 3, 4 ]) && q.length === 2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 33, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 33, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 34, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 34, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), [4]) && q.length === 1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 35, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 35, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q) !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 36, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 36, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(Belt_MutableQueue.toArray(q), []) && q.length === 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 37, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 37, + 2 + ], + Error: new Error() + }; } if (!does_raise(Belt_MutableQueue.popExn, q)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 38, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 38, + 2 + ], + Error: new Error() + }; } let q$1 = { @@ -250,68 +236,63 @@ let q$1 = { }; if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 1), q$1)) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 43, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 43, + 2 + ], + Error: new Error() + }; } if (!does_raise(Belt_MutableQueue.popExn, q$1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 44, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 44, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 2), q$1)) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 45, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 45, + 2 + ], + Error: new Error() + }; } if (!does_raise(Belt_MutableQueue.popExn, q$1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 46, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 46, + 2 + ], + Error: new Error() + }; } if (q$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 47, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 47, + 2 + ], + Error: new Error() + }; } let q$2 = { @@ -321,146 +302,135 @@ let q$2 = { }; if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 1), q$2)) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 52, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 52, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 2), q$2)) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 53, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 53, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 3), q$2)) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 54, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 54, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.peekExn(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 55, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 55, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 56, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 56, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.peekExn(q$2) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 57, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 57, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q$2) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 58, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 58, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.peekExn(q$2) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 59, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 59, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.popExn(q$2) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 60, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 60, + 2 + ], + Error: new Error() + }; } if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 61, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 61, + 2 + ], + Error: new Error() + }; } if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 62, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 62, + 2 + ], + Error: new Error() + }; } let q$3 = { @@ -476,29 +446,27 @@ for (let i = 1; i <= 10; ++i) { Belt_MutableQueue.clear(q$3); if (q$3.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 71, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 71, + 2 + ], + Error: new Error() + }; } if (!does_raise(Belt_MutableQueue.popExn, q$3)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 72, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 72, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(q$3, { @@ -506,31 +474,29 @@ if (!Caml_obj.equal(q$3, { first: undefined, last: undefined })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 73, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 73, + 2 + ], + Error: new Error() + }; } Belt_MutableQueue.add(q$3, 42); if (Belt_MutableQueue.popExn(q$3) !== 42) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 75, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 75, + 2 + ], + Error: new Error() + }; } let q1 = { @@ -557,16 +523,15 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1), [ 9, 10 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 84, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 84, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2), [ @@ -581,72 +546,67 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2), [ 9, 10 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 85, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 85, + 2 + ], + Error: new Error() + }; } if (q1.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 86, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 86, + 2 + ], + Error: new Error() + }; } if (q2.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 87, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 87, + 2 + ], + Error: new Error() + }; } for (let i$2 = 1; i$2 <= 10; ++i$2) { if (Belt_MutableQueue.popExn(q1) !== i$2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 89, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 89, + 4 + ], + Error: new Error() + }; } } for (let i$3 = 1; i$3 <= 10; ++i$3) { if (Belt_MutableQueue.popExn(q2) !== i$3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 92, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 92, + 4 + ], + Error: new Error() + }; } } @@ -658,99 +618,92 @@ let q$4 = { }; if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 98, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 98, + 2 + ], + Error: new Error() + }; } for (let i$4 = 1; i$4 <= 10; ++i$4) { Belt_MutableQueue.add(q$4, i$4); if (q$4.length !== i$4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 101, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 101, + 4 + ], + Error: new Error() + }; } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 102, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 102, + 4 + ], + Error: new Error() + }; } } for (let i$5 = 10; i$5 >= 1; --i$5) { if (q$4.length !== i$5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 105, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 105, + 4 + ], + Error: new Error() + }; } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 106, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 106, + 4 + ], + Error: new Error() + }; } Belt_MutableQueue.popExn(q$4); } if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 109, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 109, + 2 + ], + Error: new Error() + }; } if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 110, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 110, + 2 + ], + Error: new Error() + }; } let q$5 = { @@ -769,16 +722,15 @@ let i$7 = { Belt_MutableQueue.forEach(q$5, j => { if (i$7.contents !== j) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 120, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 120, + 4 + ], + Error: new Error() + }; } i$7.contents = i$7.contents + 1 | 0; }); @@ -796,109 +748,101 @@ let q2$1 = { }; if (q1$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 127, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 127, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$1), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 128, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 128, + 2 + ], + Error: new Error() + }; } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 129, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 129, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$1), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 130, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 130, + 2 + ], + Error: new Error() + }; } Belt_MutableQueue.transfer(q1$1, q2$1); if (q1$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 132, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 132, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$1), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 133, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 133, + 2 + ], + Error: new Error() + }; } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 134, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 134, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$1), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 135, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 135, + 2 + ], + Error: new Error() + }; } let q1$2 = { @@ -918,16 +862,15 @@ for (let i$8 = 1; i$8 <= 4; ++i$8) { } if (q1$2.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 143, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 143, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$2), [ @@ -936,83 +879,77 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$2), [ 3, 4 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 144, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 144, + 2 + ], + Error: new Error() + }; } if (q2$2.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 145, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 145, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$2), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 146, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 146, + 2 + ], + Error: new Error() + }; } Belt_MutableQueue.transfer(q1$2, q2$2); if (q1$2.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 148, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 148, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$2), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 149, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 149, + 2 + ], + Error: new Error() + }; } if (q2$2.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 150, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 150, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$2), [ @@ -1021,16 +958,15 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$2), [ 3, 4 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 151, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 151, + 2 + ], + Error: new Error() + }; } let q1$3 = { @@ -1050,42 +986,39 @@ for (let i$9 = 5; i$9 <= 8; ++i$9) { } if (q1$3.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 159, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 159, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$3), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 160, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 160, + 2 + ], + Error: new Error() + }; } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 161, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 161, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$3), [ @@ -1094,57 +1027,53 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$3), [ 7, 8 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 162, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 162, + 2 + ], + Error: new Error() + }; } Belt_MutableQueue.transfer(q1$3, q2$3); if (q1$3.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 164, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 164, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$3), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 165, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 165, + 2 + ], + Error: new Error() + }; } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 166, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 166, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$3), [ @@ -1153,16 +1082,15 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$3), [ 7, 8 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 167, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 167, + 2 + ], + Error: new Error() + }; } let q1$4 = { @@ -1186,16 +1114,15 @@ for (let i$11 = 5; i$11 <= 8; ++i$11) { } if (q1$4.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 178, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 178, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$4), [ @@ -1204,29 +1131,27 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$4), [ 3, 4 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 179, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 179, + 2 + ], + Error: new Error() + }; } if (q2$4.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 180, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 180, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$4), [ @@ -1235,44 +1160,41 @@ if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$4), [ 7, 8 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 181, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 181, + 2 + ], + Error: new Error() + }; } Belt_MutableQueue.transfer(q1$4, q2$4); if (q1$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 183, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 183, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q1$4), [])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 184, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 184, + 2 + ], + Error: new Error() + }; } let v = [ @@ -1287,42 +1209,39 @@ let v = [ ]; if (q2$4.length !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 186, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 186, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Belt_MutableQueue.toArray(q2$4), v)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 187, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 187, + 2 + ], + Error: new Error() + }; } if (Belt_MutableQueue.reduce(q2$4, 0, (x, y) => x - y | 0) !== Belt_Array.reduce(v, 0, (x, y) => x - y | 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 189, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 189, + 2 + ], + Error: new Error() + }; } console.log("OK"); diff --git a/jscomp/test/chn_test.js b/jscomp/test/chn_test.js index 17e05c04c4..cbd83e9c6e 100644 --- a/jscomp/test/chn_test.js +++ b/jscomp/test/chn_test.js @@ -38,16 +38,15 @@ function convert(s) { if (x$1 !== undefined) { return x$1; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "chn_test.res", - 18, - 16 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "chn_test.res", + 18, + 16 + ], + Error: new Error() + }; })); } diff --git a/jscomp/test/const_defs_test.js b/jscomp/test/const_defs_test.js index 2e2bb57544..a1b5eba93b 100644 --- a/jscomp/test/const_defs_test.js +++ b/jscomp/test/const_defs_test.js @@ -5,12 +5,11 @@ let u = 3; function f() { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "hi" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "hi", + Error: new Error() + }; } exports.u = u; diff --git a/jscomp/test/custom_error_test.js b/jscomp/test/custom_error_test.js index 0e19bcac08..882aa937a0 100644 --- a/jscomp/test/custom_error_test.js +++ b/jscomp/test/custom_error_test.js @@ -14,9 +14,7 @@ function test_js_error() { console.log(err._1.stack); return; } - throw new Error(err.RE_EXN_ID, { - cause: err - }); + throw err; } return e; } @@ -28,13 +26,9 @@ function test_js_error2() { let e = Caml_js_exceptions.internalToOCamlException(raw_e); if (e.RE_EXN_ID === Js_exn.$$Error) { console.log(e._1.stack); - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } } @@ -48,9 +42,7 @@ function example1() { console.log(err._1.stack); return; } - throw new Error(err.RE_EXN_ID, { - cause: err - }); + throw err; } return v; } @@ -63,9 +55,7 @@ function example2() { if (exn.RE_EXN_ID === Js_exn.$$Error) { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/defunctor_make_test.js b/jscomp/test/defunctor_make_test.js index 1e0ac446ce..efc2f442f8 100644 --- a/jscomp/test/defunctor_make_test.js +++ b/jscomp/test/defunctor_make_test.js @@ -44,12 +44,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r._4; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l._3; let ld = l._2; @@ -61,12 +60,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -79,12 +77,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r._3; let rd = r._2; @@ -96,12 +93,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, compare, x_) { diff --git a/jscomp/test/demo_int_map.js b/jscomp/test/demo_int_map.js index 50052476dc..71b93d86cc 100644 --- a/jscomp/test/demo_int_map.js +++ b/jscomp/test/demo_int_map.js @@ -30,12 +30,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -47,12 +46,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -65,12 +63,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -82,12 +79,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, param) { @@ -140,11 +136,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = x - param.v | 0; if (c === 0) { diff --git a/jscomp/test/earger_curry_test.js b/jscomp/test/earger_curry_test.js index c5cc837bc7..fb598eacf0 100644 --- a/jscomp/test/earger_curry_test.js +++ b/jscomp/test/earger_curry_test.js @@ -24,12 +24,11 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.init", + Error: new Error() + }; } let res = Caml_array.make(l, f$1(0)); for (let i = 1; i < l; ++i) { diff --git a/jscomp/test/equal_exception_test.js b/jscomp/test/equal_exception_test.js index 263778a862..04bff576e3 100644 --- a/jscomp/test/equal_exception_test.js +++ b/jscomp/test/equal_exception_test.js @@ -13,73 +13,66 @@ let v = "gso"; function is_equal() { if (Caml_bytes.get(Bytes.make(3, /* 'a' */97), 0) !== /* 'a' */97) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 4, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 4, + 2 + ], + Error: new Error() + }; } if (Bytes.make(3, /* 'a' */97)[0] !== /* 'a' */97) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 5, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 5, + 2 + ], + Error: new Error() + }; } let u = Bytes.make(3, /* 'a' */97); u[0] = /* 'b' */98; if (u[0] !== /* 'b' */98) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 8, - 2 - ] - } - }); - } - if (Caml_string.get(v, 0) === /* 'g' */103) { - return; - } - throw new Error("Assert_failure", { - cause: { + throw { RE_EXN_ID: "Assert_failure", _1: [ "equal_exception_test.res", - 9, + 8, 2 - ] - } - }); + ], + Error: new Error() + }; + } + if (Caml_string.get(v, 0) === /* 'g' */103) { + return; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 9, + 2 + ], + Error: new Error() + }; } function is_exception() { try { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -90,33 +83,26 @@ function is_normal_exception(_x) { _1: 3 }; try { - throw new Error(v.RE_EXN_ID, { - cause: v - }); + throw v; } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === A) { if (exn._1 === 3) { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } function is_arbitrary_exception() { let A = /* @__PURE__ */Caml_exceptions.create("A"); try { - throw new Error(A, { - cause: { - RE_EXN_ID: A - } - }); + throw { + RE_EXN_ID: A, + Error: new Error() + }; } catch (exn) { return; } @@ -165,29 +151,27 @@ let Not_found = /* @__PURE__ */Caml_exceptions.create("Equal_exception_test.Not_ if (Caml_obj.equal(e, { RE_EXN_ID: Not_found }) !== false) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 50, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 50, + 0 + ], + Error: new Error() + }; } if (Not_found === "Not_found" !== false) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 51, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 51, + 0 + ], + Error: new Error() + }; } Mt.from_suites("exception", suites); diff --git a/jscomp/test/exception_raise_test.js b/jscomp/test/exception_raise_test.js index e847b09f39..d39772e1ca 100644 --- a/jscomp/test/exception_raise_test.js +++ b/jscomp/test/exception_raise_test.js @@ -94,16 +94,15 @@ try { if (x$3.RE_EXN_ID === A || x$3.RE_EXN_ID === Js_exn.$$Error) { a0 = x$3._1; } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_raise_test.res", - 104, - 7 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_raise_test.res", + 104, + 7 + ], + Error: new Error() + }; } } @@ -154,16 +153,15 @@ let suites = { _1: 2 }; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_raise_test.res", - 127, - 15 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_raise_test.res", + 127, + 15 + ], + Error: new Error() + }; } ], tl: /* [] */0 @@ -187,11 +185,10 @@ try { } try { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } catch (raw_e$3) { let e$1 = Caml_js_exceptions.internalToOCamlException(raw_e$3); eq("File \"exception_raise_test.res\", line 141, characters 10-17", Caml_js_exceptions.as_js_exn(e$1) !== undefined, false); diff --git a/jscomp/test/exception_rebound_err_test.js b/jscomp/test/exception_rebound_err_test.js index e795fde624..4fe7c956c2 100644 --- a/jscomp/test/exception_rebound_err_test.js +++ b/jscomp/test/exception_rebound_err_test.js @@ -70,9 +70,7 @@ function f(g) { if (exn.RE_EXN_ID === "Not_found") { return 1; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/exception_value_test.js b/jscomp/test/exception_value_test.js index dee7400ffb..8be5392bda 100644 --- a/jscomp/test/exception_value_test.js +++ b/jscomp/test/exception_value_test.js @@ -6,35 +6,32 @@ let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function assert_f(x) { if (x <= 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_value_test.res", - 4, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_value_test.res", + 4, + 11 + ], + Error: new Error() + }; } return 3; } function hh() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let A = /* @__PURE__ */Caml_exceptions.create("Exception_value_test.A"); @@ -56,9 +53,7 @@ function test_not_found(f, param) { if (exn.RE_EXN_ID === "Not_found") { return 2; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -69,13 +64,9 @@ function test_js_error2() { let e = Caml_js_exceptions.internalToOCamlException(raw_e); if (e.RE_EXN_ID === Js_exn.$$Error) { console.log(e._1.stack); - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } } diff --git a/jscomp/test/ext_array_test.js b/jscomp/test/ext_array_test.js index 7c824a62e7..db46f8d66a 100644 --- a/jscomp/test/ext_array_test.js +++ b/jscomp/test/ext_array_test.js @@ -105,12 +105,11 @@ function filter_map(f, a) { function range(from, to_) { if (from > to_) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_array_test.range" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.range", + Error: new Error() + }; } return $$Array.init((to_ - from | 0) + 1 | 0, i => i + from | 0); } @@ -118,12 +117,11 @@ function range(from, to_) { function map2i(f, a, b) { let len = a.length; if (len !== b.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_array_test.map2i" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.map2i", + Error: new Error() + }; } return $$Array.mapi((i, a) => f(i, a, b[i]), a); } diff --git a/jscomp/test/ext_bytes_test.js b/jscomp/test/ext_bytes_test.js index 3a7ad98c91..768eb67bc4 100644 --- a/jscomp/test/ext_bytes_test.js +++ b/jscomp/test/ext_bytes_test.js @@ -134,11 +134,10 @@ function starts_with(xs, prefix, p) { try { for (let i = 0; i < len2; ++i) { if (!p(Caml_bytes.get(xs, i), Caml_bytes.get(prefix, i))) { - throw new Error(H, { - cause: { - RE_EXN_ID: H - } - }); + throw { + RE_EXN_ID: H, + Error: new Error() + }; } } @@ -148,9 +147,7 @@ function starts_with(xs, prefix, p) { if (exn.RE_EXN_ID === H) { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/ext_filename_test.js b/jscomp/test/ext_filename_test.js index 7628c95abe..40c76532e1 100644 --- a/jscomp/test/ext_filename_test.js +++ b/jscomp/test/ext_filename_test.js @@ -61,16 +61,13 @@ function chop_extension(locOpt, name) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Invalid_argument") { let s = "Filename.chop_extension ( " + loc + " : " + name + " )"; - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -82,9 +79,7 @@ function chop_extension_if_any(fname) { if (exn.RE_EXN_ID === "Invalid_argument") { return fname; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -142,12 +137,11 @@ function node_relative_path(node_modules_shorten, file1, dep_file) { let i = _i; if (i >= len) { let s = "invalid path: " + file2; - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } - }); + throw { + RE_EXN_ID: "Failure", + _1: s, + Error: new Error() + }; } let curr_char = file2.codePointAt(i); if (!(curr_char === os_path_separator_char || curr_char === /* '.' */46)) { @@ -172,12 +166,11 @@ function find_root_filename(_cwd, filename) { continue; } let s = filename + " not found from " + cwd; - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } - }); + throw { + RE_EXN_ID: "Failure", + _1: s, + Error: new Error() + }; }; } @@ -344,12 +337,11 @@ if (Sys.unix) { simple_convert_node_path_to_os_path = Ext_string_test.replace_slash_backward; } else { let s = "Unknown OS : " + Sys.os_type; - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } - }); + throw { + RE_EXN_ID: "Failure", + _1: s, + Error: new Error() + }; } let $slash$slash = Filename.concat; diff --git a/jscomp/test/ext_list_test.js b/jscomp/test/ext_list_test.js index 5c17bb62a0..0293bd0bb7 100644 --- a/jscomp/test/ext_list_test.js +++ b/jscomp/test/ext_list_test.js @@ -203,22 +203,20 @@ function filter_map2(f, _xs, _ys) { _xs = us; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.filter_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2", + Error: new Error() + }; } if (!ys) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.filter_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2", + Error: new Error() + }; }; } @@ -244,22 +242,20 @@ function filter_map2i(f, xs, ys) { _i = i + 1 | 0; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.filter_map2i" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2i", + Error: new Error() + }; } if (!ys) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.filter_map2i" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2i", + Error: new Error() + }; }; }; return aux(0, xs, ys); @@ -296,20 +292,18 @@ function flat_map2(f, lx, ly) { _acc = List.rev_append(f(lx$1.hd, ly$1.hd), acc); continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.flat_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.flat_map2", + Error: new Error() + }; } if (ly$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.flat_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.flat_map2", + Error: new Error() + }; } return List.rev(acc); }; @@ -350,12 +344,11 @@ function map2_last(f, l1, l2) { } } else { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2_last" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2_last", + Error: new Error() + }; } } if (l2) { @@ -365,22 +358,20 @@ function map2_last(f, l1, l2) { tl: map2_last(f, l1$1, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2_last" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2_last", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2_last" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2_last", + Error: new Error() + }; } function map_last(f, l1) { @@ -413,31 +404,28 @@ function fold_right2_last(f, l1, l2, accu) { } } else { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } } if (l2) { return f(false, last1, l2.hd, fold_right2_last(f, l1$1, l2.tl, accu)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } return accu; } @@ -450,12 +438,11 @@ function take(n, l) { let arr = $$Array.of_list(l); let arr_length = arr.length; if (arr_length < n) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.take" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.take", + Error: new Error() + }; } return [ $$Array.to_list($$Array.sub(arr, 0, n)), @@ -539,12 +526,11 @@ function exclude_tail(x) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.exclude_tail" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.exclude_tail", + Error: new Error() + }; }; } @@ -593,23 +579,21 @@ function drop(_n, _h) { let h = _h; let n = _n; if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.drop" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.drop", + Error: new Error() + }; } if (n === 0) { return h; } if (h === /* [] */0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.drop" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.drop", + Error: new Error() + }; } _h = List.tl(h); _n = n - 1 | 0; @@ -774,24 +758,22 @@ function reduce_from_right(fn, lst) { if (match) { return List.fold_left((x, y) => fn(y, x), match.hd, match.tl); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.reduce" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.reduce", + Error: new Error() + }; } function reduce_from_left(fn, lst) { if (lst) { return List.fold_left(fn, lst.hd, lst.tl); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.reduce_from_left" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.reduce_from_left", + Error: new Error() + }; } function create_ref_empty() { @@ -805,12 +787,11 @@ function ref_top(x) { if (match) { return match.hd; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.ref_top" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.ref_top", + Error: new Error() + }; } function ref_empty(x) { @@ -835,12 +816,11 @@ function ref_pop(refs) { refs.contents = match.tl; return match.hd; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.ref_pop" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.ref_pop", + Error: new Error() + }; } function rev_except_last(xs) { @@ -865,12 +845,11 @@ function rev_except_last(xs) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.rev_except_last" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.rev_except_last", + Error: new Error() + }; }; } @@ -891,12 +870,11 @@ function last(_xs) { _xs = tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.last" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.last", + Error: new Error() + }; }; } @@ -914,16 +892,15 @@ function assoc_by_string(def, k, _lst) { if (def !== undefined) { return Caml_option.valFromOption(def); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ext_list_test.res", - 472, - 14 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "ext_list_test.res", + 472, + 14 + ], + Error: new Error() + }; }; } @@ -941,16 +918,15 @@ function assoc_by_int(def, k, _lst) { if (def !== undefined) { return Caml_option.valFromOption(def); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ext_list_test.res", - 487, - 14 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "ext_list_test.res", + 487, + 14 + ], + Error: new Error() + }; }; } diff --git a/jscomp/test/ext_pervasives_test.js b/jscomp/test/ext_pervasives_test.js index 5527fdf735..d32b817ff6 100644 --- a/jscomp/test/ext_pervasives_test.js +++ b/jscomp/test/ext_pervasives_test.js @@ -11,9 +11,7 @@ function $$finally(v, action, f) { e = f(v); } catch (e$1) { action(v); - throw new Error(e$1.RE_EXN_ID, { - cause: e$1 - }); + throw e$1; } action(v); return e; @@ -38,20 +36,17 @@ function is_pos_pow(n) { _c = c + 1 | 0; continue; } - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw { + RE_EXN_ID: E, + Error: new Error() + }; }; } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === E) { return -1; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -74,20 +69,17 @@ function is_pos_pow_2(n) { _c = c + 1 | 0; continue; } - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw { + RE_EXN_ID: E, + Error: new Error() + }; }; } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === E) { return -1; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/ext_string_test.js b/jscomp/test/ext_string_test.js index 69409ccddf..75b2da3878 100644 --- a/jscomp/test/ext_string_test.js +++ b/jscomp/test/ext_string_test.js @@ -213,12 +213,11 @@ function unsafe_for_all_range(s, _start, finish, p) { function for_all_range(s, start, finish, p) { let len = s.length; if (start < 0 || finish >= len) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.for_all_range" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.for_all_range", + Error: new Error() + }; } return unsafe_for_all_range(s, start, finish, p); } @@ -269,11 +268,10 @@ function find(startOpt, sub, s) { try { while ((i + n | 0) <= s_len) { if (unsafe_is_sub(sub, 0, s, i, n)) { - throw new Error(Local_exit, { - cause: { - RE_EXN_ID: Local_exit - } - }); + throw { + RE_EXN_ID: Local_exit, + Error: new Error() + }; } i = i + 1 | 0; }; @@ -283,9 +281,7 @@ function find(startOpt, sub, s) { if (exn.RE_EXN_ID === Local_exit) { return i; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -296,12 +292,11 @@ function contain_substring(s, sub) { function non_overlap_count(sub, s) { let sub_len = sub.length; if (sub.length === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.non_overlap_count" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.non_overlap_count", + Error: new Error() + }; } let _acc = 0; let _off = 0; @@ -324,11 +319,10 @@ function rfind(sub, s) { try { while (i >= 0) { if (unsafe_is_sub(sub, 0, s, i, n)) { - throw new Error(Local_exit, { - cause: { - RE_EXN_ID: Local_exit - } - }); + throw { + RE_EXN_ID: Local_exit, + Error: new Error() + }; } i = i - 1 | 0; }; @@ -338,9 +332,7 @@ function rfind(sub, s) { if (exn.RE_EXN_ID === Local_exit) { return i; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -350,12 +342,11 @@ function tail_from(s, x) { return $$String.sub(s, x, len - x | 0); } let s$1 = "Ext_string_test.tail_from " + (s + (" : " + String(x))); - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s$1 - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s$1, + Error: new Error() + }; } function digits_of_str(s, offset, x) { @@ -548,12 +539,11 @@ function unsafe_no_char_idx(x, ch, _i, last_idx) { function no_char(x, ch, i, len) { let str_len = x.length; if (i < 0 || i >= str_len || len >= str_len) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_string_test.no_char" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.no_char", + Error: new Error() + }; } return unsafe_no_char(x, ch, i, len); } diff --git a/jscomp/test/extensible_variant_test.js b/jscomp/test/extensible_variant_test.js index cfadcd2dde..c80e4eac79 100644 --- a/jscomp/test/extensible_variant_test.js +++ b/jscomp/test/extensible_variant_test.js @@ -24,16 +24,15 @@ function to_int(x) { if (x.RE_EXN_ID === Int$1) { return x._2; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "extensible_variant_test.res", - 16, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "extensible_variant_test.res", + 16, + 9 + ], + Error: new Error() + }; } let suites_0 = [ diff --git a/jscomp/test/flexible_array_test.js b/jscomp/test/flexible_array_test.js index 7e932c4ae9..0a99587305 100644 --- a/jscomp/test/flexible_array_test.js +++ b/jscomp/test/flexible_array_test.js @@ -10,11 +10,10 @@ function sub(_tr, _k) { let k = _k; let tr = _tr; if (typeof tr !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (k === 1) { return tr._0; @@ -40,11 +39,10 @@ function update(tr, k, w) { _2: "Lf" }; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = tr._2; let l = tr._1; @@ -76,11 +74,10 @@ function update(tr, k, w) { function $$delete(tr, n) { if (typeof tr !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (n === 1) { return "Lf"; @@ -125,11 +122,10 @@ function loext(tr, w) { function lorem(tr) { if (typeof tr !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = tr._1; if (typeof l === "object") { @@ -144,16 +140,15 @@ function lorem(tr) { if (typeof tmp !== "object") { return "Lf"; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "flexible_array_test.res", - 80, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "flexible_array_test.res", + 80, + 9 + ], + Error: new Error() + }; } let empty = [ @@ -169,12 +164,11 @@ function get(param, i) { if (i >= 0 && i < param[1]) { return sub(param[0], i + 1 | 0); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.get" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.get", + Error: new Error() + }; } function set(param, i, v) { @@ -185,12 +179,11 @@ function set(param, i, v) { k ]; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.set" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.set", + Error: new Error() + }; } function push_front(param, v) { @@ -208,12 +201,11 @@ function pop_front(param) { k - 1 | 0 ]; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.pop_front" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.pop_front", + Error: new Error() + }; } function push_back(param, v) { @@ -232,12 +224,11 @@ function pop_back(param) { k - 1 | 0 ]; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.pop_back" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.pop_back", + Error: new Error() + }; } function filter_from(i, p, s) { @@ -319,16 +310,15 @@ if (!$eq$tilde(sort(u), [ 5, 6 ])) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "flexible_array_test.res", - 184, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "flexible_array_test.res", + 184, + 2 + ], + Error: new Error() + }; } let v = $$Array.init(500, i => 500 - i | 0); diff --git a/jscomp/test/format_regression.js b/jscomp/test/format_regression.js index c89043c8cd..4f2a36aadf 100644 --- a/jscomp/test/format_regression.js +++ b/jscomp/test/format_regression.js @@ -3,55 +3,51 @@ function peek_queue(param) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 10, - 22 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 10, + 22 + ], + Error: new Error() + }; } function int_of_size(param) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 11, - 23 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 11, + 23 + ], + Error: new Error() + }; } function take_queue(param) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 12, - 22 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 12, + 22 + ], + Error: new Error() + }; } function format_pp_token(param, param$1, param$2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 13, - 35 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 13, + 35 + ], + Error: new Error() + }; } function advance_loop(state) { diff --git a/jscomp/test/fun_pattern_match.js b/jscomp/test/fun_pattern_match.js index e2cab8232f..9b3880f260 100644 --- a/jscomp/test/fun_pattern_match.js +++ b/jscomp/test/fun_pattern_match.js @@ -22,16 +22,15 @@ function f3(param, param$1) { } rhs === "Uninitialized"; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 33, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 33, + 9 + ], + Error: new Error() + }; } function f4(param, param$1) { @@ -45,16 +44,15 @@ function f4(param, param$1) { } rhs === "Uninitialized"; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 39, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 39, + 9 + ], + Error: new Error() + }; } let x = { diff --git a/jscomp/test/genlex_test.js b/jscomp/test/genlex_test.js index 7aa4e74b15..00a8e97383 100644 --- a/jscomp/test/genlex_test.js +++ b/jscomp/test/genlex_test.js @@ -45,9 +45,7 @@ function to_list(s) { if (exn.RE_EXN_ID === Stream.Failure) { return List.rev(acc); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } _acc = { hd: v, diff --git a/jscomp/test/gpr_1150.js b/jscomp/test/gpr_1150.js index d8286103da..b5cc9c15ab 100644 --- a/jscomp/test/gpr_1150.js +++ b/jscomp/test/gpr_1150.js @@ -215,16 +215,15 @@ function f(children) { ]; } if (children$15.tl) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_1150.res", - 100, - 62 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1150.res", + 100, + 62 + ], + Error: new Error() + }; } return [ a0, diff --git a/jscomp/test/gpr_1245_test.js b/jscomp/test/gpr_1245_test.js index e1e0e9044b..3ed9c70903 100644 --- a/jscomp/test/gpr_1245_test.js +++ b/jscomp/test/gpr_1245_test.js @@ -46,9 +46,7 @@ function a1(f) { if (exn.RE_EXN_ID === E) { return 1; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/gpr_1698_test.js b/jscomp/test/gpr_1698_test.js index 70186a2079..a85cfeee77 100644 --- a/jscomp/test/gpr_1698_test.js +++ b/jscomp/test/gpr_1698_test.js @@ -48,16 +48,15 @@ function compare(context, state, _a, _b) { exit$2 = 4; break; case "Frac" : - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_1698_test.res", - 41, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1698_test.res", + 41, + 9 + ], + Error: new Error() + }; case "Pow" : case "Gcd" : exit = 1; @@ -74,16 +73,15 @@ function compare(context, state, _a, _b) { case "Frac" : switch (b.TAG) { case "Val" : - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_1698_test.res", - 41, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1698_test.res", + 41, + 9 + ], + Error: new Error() + }; case "Neg" : exit$3 = 5; break; diff --git a/jscomp/test/gpr_1701_test.js b/jscomp/test/gpr_1701_test.js index dbf9f7c67a..b55d0aa9b7 100644 --- a/jscomp/test/gpr_1701_test.js +++ b/jscomp/test/gpr_1701_test.js @@ -9,11 +9,10 @@ let Foo = /* @__PURE__ */Caml_exceptions.create("Gpr_1701_test.Foo"); function test(n) { if (n === 0) { - throw new Error(Foo, { - cause: { - RE_EXN_ID: Foo - } - }); + throw { + RE_EXN_ID: Foo, + Error: new Error() + }; } try { return test(n - 1 | 0); @@ -22,9 +21,7 @@ function test(n) { if (exn.RE_EXN_ID === Foo) { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -42,9 +39,7 @@ function read_lines(inc) { if (exn.RE_EXN_ID === "End_of_file") { l = undefined; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } if (l === undefined) { @@ -70,9 +65,7 @@ function read_lines2(inc) { if (exn.RE_EXN_ID === "End_of_file") { return List.rev(acc); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } _acc = { hd: l, @@ -95,9 +88,7 @@ function read_lines3(inc) { if (exn.RE_EXN_ID === "End_of_file") { return List.rev(acc); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; return loop(/* [] */0); diff --git a/jscomp/test/gpr_2316_test.js b/jscomp/test/gpr_2316_test.js index aa33122ecb..f9c22395bd 100644 --- a/jscomp/test/gpr_2316_test.js +++ b/jscomp/test/gpr_2316_test.js @@ -30,20 +30,17 @@ function eq(loc, x, y) { let y; try { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "boo" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "boo", + Error: new Error() + }; } catch (raw_msg) { let msg = Caml_js_exceptions.internalToOCamlException(raw_msg); if (msg.RE_EXN_ID === "Failure") { y = msg._1; } else { - throw new Error(msg.RE_EXN_ID, { - cause: msg - }); + throw msg; } } @@ -52,20 +49,17 @@ let x; let exit = 0; try { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "boo" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "boo", + Error: new Error() + }; } catch (raw_msg$1) { let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg$1); if (msg$1.RE_EXN_ID === "Failure") { x = msg$1._1; } else { - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } diff --git a/jscomp/test/gpr_2682_test.js b/jscomp/test/gpr_2682_test.js index 4b85655c95..1c07be7aca 100644 --- a/jscomp/test/gpr_2682_test.js +++ b/jscomp/test/gpr_2682_test.js @@ -46,16 +46,15 @@ let f3 = (()=>true); let bbbb = f3(); if (!bbbb) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_2682_test.res", - 52, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_2682_test.res", + 52, + 0 + ], + Error: new Error() + }; } exports.sum = sum; diff --git a/jscomp/test/gpr_3877_test.js b/jscomp/test/gpr_3877_test.js index 2e8759406b..27c66d7aef 100644 --- a/jscomp/test/gpr_3877_test.js +++ b/jscomp/test/gpr_3877_test.js @@ -21,29 +21,27 @@ let a = "good response"; let b = "bad response"; if (a !== "good response") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3877_test.res", - 26, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3877_test.res", + 26, + 0 + ], + Error: new Error() + }; } if (b !== "bad response") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3877_test.res", - 27, - 0 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3877_test.res", + 27, + 0 + ], + Error: new Error() + }; } exports.test = test; diff --git a/jscomp/test/gpr_3980_test.js b/jscomp/test/gpr_3980_test.js index 3509224e47..3dc94cb04b 100644 --- a/jscomp/test/gpr_3980_test.js +++ b/jscomp/test/gpr_3980_test.js @@ -7,45 +7,42 @@ let match = 1; if (match !== undefined) { if (match !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 15, - 7 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 15, + 7 + ], + Error: new Error() + }; } let match$1 = 1; if (match$1 !== 1) { if (match$1 !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 13, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 13, + 9 + ], + Error: new Error() + }; } Js_math.floor(1); } } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 15, - 7 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 15, + 7 + ], + Error: new Error() + }; } /* Not a pure module */ diff --git a/jscomp/test/gpr_405_test.js b/jscomp/test/gpr_405_test.js index 3c406084b4..07aa61fba2 100644 --- a/jscomp/test/gpr_405_test.js +++ b/jscomp/test/gpr_405_test.js @@ -19,9 +19,7 @@ function Make(funarg) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let min_cutset = (gr, first_node) => { @@ -37,28 +35,26 @@ function Make(funarg) { }; let step2 = (top, rest_of_stack) => { if (find_default(already_processed, top)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_405_test.res", - 40, - 6 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_405_test.res", + 40, + 6 + ], + Error: new Error() + }; } if (find_default(on_the_stack, top)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_405_test.res", - 41, - 6 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_405_test.res", + 41, + 6 + ], + Error: new Error() + }; } H.add(on_the_stack, top, true); H.add(n_labels, top, counter.contents); @@ -96,12 +92,11 @@ function Make(funarg) { H.add(l_labels, top$1, 0); } if (H.find(l_labels, top$1) > H.find(n_labels, top$1)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Graph.Mincut: graph not reducible" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Graph.Mincut: graph not reducible", + Error: new Error() + }; } if (!rest_of_stack$1) { return cut_set.contents; diff --git a/jscomp/test/gpr_4632.js b/jscomp/test/gpr_4632.js index ec0408651d..fa3f84ae3c 100644 --- a/jscomp/test/gpr_4632.js +++ b/jscomp/test/gpr_4632.js @@ -21,16 +21,15 @@ let T0 = { tail: T0_tail }; -throw new Error("Match_failure", { - cause: { - RE_EXN_ID: "Match_failure", - _1: [ - "gpr_4632.res", - 12, - 6 - ] - } -}); +throw { + RE_EXN_ID: "Match_failure", + _1: [ + "gpr_4632.res", + 12, + 6 + ], + Error: new Error() +}; exports.T0 = T0; exports.T1 = T1; diff --git a/jscomp/test/gpr_5557.js b/jscomp/test/gpr_5557.js index 0ca3201b67..54715699d9 100644 --- a/jscomp/test/gpr_5557.js +++ b/jscomp/test/gpr_5557.js @@ -6,16 +6,15 @@ function isA(c) { if (c === 97) { return true; } - throw new Error("Match_failure", { - cause: { - RE_EXN_ID: "Match_failure", - _1: [ - "gpr_5557.res", - 5, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Match_failure", + _1: [ + "gpr_5557.res", + 5, + 2 + ], + Error: new Error() + }; } let h = /* 'a' */97; diff --git a/jscomp/test/gpr_858_unit2_test.js b/jscomp/test/gpr_858_unit2_test.js index 8485cff5a8..4ca3b4244e 100644 --- a/jscomp/test/gpr_858_unit2_test.js +++ b/jscomp/test/gpr_858_unit2_test.js @@ -19,16 +19,15 @@ for (let i = 1; i <= 2; ++i) { if (i === n) { return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_858_unit2_test.res", - 6, - 13 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_858_unit2_test.res", + 6, + 13 + ], + Error: new Error() + }; }; f(0, i); } diff --git a/jscomp/test/gpr_974_test.js b/jscomp/test/gpr_974_test.js index 0c7ede290d..97b799e72a 100644 --- a/jscomp/test/gpr_974_test.js +++ b/jscomp/test/gpr_974_test.js @@ -5,42 +5,39 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_option = require("../../lib/js/caml_option.js"); if (!Caml_obj.equal(Caml_option.nullable_to_opt(""), "")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_974_test.res", - 2, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 2, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Caml_option.undefined_to_opt(""), "")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_974_test.res", - 3, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 3, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(Caml_option.null_to_opt(""), "")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_974_test.res", - 4, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 4, + 2 + ], + Error: new Error() + }; } /* Not a pure module */ diff --git a/jscomp/test/inline_map2_test.js b/jscomp/test/inline_map2_test.js index f9d8d4da7c..663e15c663 100644 --- a/jscomp/test/inline_map2_test.js +++ b/jscomp/test/inline_map2_test.js @@ -41,12 +41,11 @@ function Make(Ord) { hr = typeof r !== "object" ? 0 : r._4; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l._3; let ld = l._2; @@ -58,12 +57,11 @@ function Make(Ord) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -76,12 +74,11 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r._3; let rd = r._2; @@ -93,12 +90,11 @@ function Make(Ord) { if (typeof rl === "object") { return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = x => { if (typeof x !== "object") { @@ -142,11 +138,10 @@ function Make(Ord) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Ord.compare(x, x_._1); if (c === 0) { @@ -174,11 +169,10 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -195,11 +189,10 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = x._3; if (typeof r !== "object") { @@ -214,12 +207,11 @@ function Make(Ord) { }; let remove_min_binding = x => { if (typeof x !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -439,16 +431,15 @@ function Make(Ord) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map2_test.res", - 359, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ], + Error: new Error() + }; } let v2 = s2._1; let match$1 = split(v2, s1); @@ -675,12 +666,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r._4; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l._3; let ld = l._2; @@ -692,12 +682,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -710,12 +699,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r._3; let rd = r._2; @@ -727,12 +715,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty(x) { @@ -779,11 +766,10 @@ function find(x, _x_) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(x, x_._1); if (c === 0) { @@ -813,11 +799,10 @@ function min_binding(_x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -835,11 +820,10 @@ function max_binding(_x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = x._3; if (typeof r !== "object") { @@ -855,12 +839,11 @@ function max_binding(_x) { function remove_min_binding(x) { if (typeof x !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -1094,16 +1077,15 @@ function merge(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map2_test.res", - 359, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ], + Error: new Error() + }; } let v2 = s2._1; let match$1 = split(v2, s1); @@ -1366,12 +1348,11 @@ function bal$1(l, x, d, r) { hr = typeof r !== "object" ? 0 : r._4; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l._3; let ld = l._2; @@ -1383,12 +1364,11 @@ function bal$1(l, x, d, r) { if (typeof lr === "object") { return create$1(create$1(ll, lv, ld, lr._0), lr._1, lr._2, create$1(lr._3, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -1401,12 +1381,11 @@ function bal$1(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r._3; let rd = r._2; @@ -1418,12 +1397,11 @@ function bal$1(l, x, d, r) { if (typeof rl === "object") { return create$1(create$1(l, x, d, rl._0), rl._1, rl._2, create$1(rl._3, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty$1(x) { @@ -1470,11 +1448,10 @@ function find$1(x, _x_) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.string_compare(x, x_._1); if (c === 0) { @@ -1504,11 +1481,10 @@ function min_binding$1(_x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -1526,11 +1502,10 @@ function max_binding$1(_x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = x._3; if (typeof r !== "object") { @@ -1546,12 +1521,11 @@ function max_binding$1(_x) { function remove_min_binding$1(x) { if (typeof x !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -1785,16 +1759,15 @@ function merge$1(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map2_test.res", - 359, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ], + Error: new Error() + }; } let v2 = s2._1; let match$1 = split$1(v2, s1); diff --git a/jscomp/test/inline_map_demo.js b/jscomp/test/inline_map_demo.js index 10ebfd5494..cfdd7e8fff 100644 --- a/jscomp/test/inline_map_demo.js +++ b/jscomp/test/inline_map_demo.js @@ -33,16 +33,15 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r._4; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 41, - 15 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 41, + 15 + ], + Error: new Error() + }; } let lr = l._3; let ld = l._2; @@ -54,16 +53,15 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 47, - 19 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 47, + 19 + ], + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -76,16 +74,15 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 55, - 15 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 55, + 15 + ], + Error: new Error() + }; } let rr = r._3; let rd = r._2; @@ -97,16 +94,15 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 61, - 19 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 61, + 19 + ], + Error: new Error() + }; } function add(x, data, tree) { @@ -171,11 +167,10 @@ function find(px, _x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(px, x._1); if (c === 0) { diff --git a/jscomp/test/inline_map_test.js b/jscomp/test/inline_map_test.js index 343b9ec72f..2685f057f3 100644 --- a/jscomp/test/inline_map_test.js +++ b/jscomp/test/inline_map_test.js @@ -33,12 +33,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r._4; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l._3; let ld = l._2; @@ -50,12 +49,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -68,12 +66,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r._3; let rd = r._2; @@ -85,12 +82,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, x_) { @@ -129,11 +125,10 @@ function find(x, _x_) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(x, x_._1); if (c === 0) { diff --git a/jscomp/test/inline_record_test.js b/jscomp/test/inline_record_test.js index b6e71324b1..9346f7a9f7 100644 --- a/jscomp/test/inline_record_test.js +++ b/jscomp/test/inline_record_test.js @@ -63,16 +63,15 @@ let tmp; if (A0 === A0) { tmp = 3; } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 47, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 47, + 9 + ], + Error: new Error() + }; } eq("File \"inline_record_test.res\", line 44, characters 2-9", tmp, 3); @@ -107,16 +106,15 @@ let tmp$1; if (v4.TAG === "A0") { tmp$1 = v4.x; } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 74, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 74, + 9 + ], + Error: new Error() + }; } eq("File \"inline_record_test.res\", line 71, characters 2-9", tmp$1, 11); @@ -124,16 +122,15 @@ eq("File \"inline_record_test.res\", line 71, characters 2-9", tmp$1, 11); let tmp$2; if (v5.TAG === "A0") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 83, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 83, + 9 + ], + Error: new Error() + }; } tmp$2 = v5.z; @@ -167,16 +164,15 @@ let tmp$3; if (v6.RE_EXN_ID === A4) { tmp$3 = v6.x; } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 108, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 108, + 9 + ], + Error: new Error() + }; } eq("File \"inline_record_test.res\", line 105, characters 2-9", tmp$3, 11); diff --git a/jscomp/test/int64_string_test.js b/jscomp/test/int64_string_test.js index c1ce0329b6..306f2c2b00 100644 --- a/jscomp/test/int64_string_test.js +++ b/jscomp/test/int64_string_test.js @@ -1307,30 +1307,28 @@ let random_data = { Belt_List.forEach(random_data, u => { if (u) { if (u.tl) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "int64_string_test.res", - 191, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "int64_string_test.res", + 191, + 9 + ], + Error: new Error() + }; } let match = u.hd; return eq("File \"int64_string_test.res\", line 190, characters 25-32", Caml_int64.to_string(match[0]), match[1]); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "int64_string_test.res", - 191, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "int64_string_test.res", + 191, + 9 + ], + Error: new Error() + }; }); eq("File \"int64_string_test.res\", line 195, characters 3-10", Caml_int64.to_string([ diff --git a/jscomp/test/int_map.js b/jscomp/test/int_map.js index 25b7da89be..23f88f7c66 100644 --- a/jscomp/test/int_map.js +++ b/jscomp/test/int_map.js @@ -43,12 +43,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -60,12 +59,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -78,12 +76,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -95,12 +92,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty(param) { @@ -161,11 +157,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -180,11 +175,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -258,11 +252,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -366,11 +359,10 @@ function min_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -406,11 +398,10 @@ function max_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -444,12 +435,11 @@ function max_binding_opt(_param) { function remove_min_binding(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -753,16 +743,15 @@ function merge$1(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); diff --git a/jscomp/test/internal_unused_test.js b/jscomp/test/internal_unused_test.js index 006038bf8a..222fa625c9 100644 --- a/jscomp/test/internal_unused_test.js +++ b/jscomp/test/internal_unused_test.js @@ -8,11 +8,10 @@ console.log(3); let A = /* @__PURE__ */Caml_exceptions.create("Internal_unused_test.P1.A"); function f() { - throw new Error(A, { - cause: { - RE_EXN_ID: A - } - }); + throw { + RE_EXN_ID: A, + Error: new Error() + }; } let c = 5; diff --git a/jscomp/test/js_exception_catch_test.js b/jscomp/test/js_exception_catch_test.js index f4580b614a..7bdbb1b6b4 100644 --- a/jscomp/test/js_exception_catch_test.js +++ b/jscomp/test/js_exception_catch_test.js @@ -63,9 +63,7 @@ try { _0: true })); } else { - throw new Error(x.RE_EXN_ID, { - cause: x - }); + throw x; } } @@ -121,90 +119,79 @@ function test(f) { eq("File \"js_exception_catch_test.res\", line 44, characters 5-12", test(() => {}), "No_error"); eq("File \"js_exception_catch_test.res\", line 45, characters 5-12", test(() => { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }), "Not_found"); eq("File \"js_exception_catch_test.res\", line 46, characters 5-12", test(() => { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "x" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "x", + Error: new Error() + }; }), "Invalid_argument"); eq("File \"js_exception_catch_test.res\", line 47, characters 5-12", test(() => { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "", + Error: new Error() + }; }), "Invalid_any"); eq("File \"js_exception_catch_test.res\", line 48, characters 5-12", test(() => { - throw new Error(A, { - cause: { - RE_EXN_ID: A, - _1: 2 - } - }); + throw { + RE_EXN_ID: A, + _1: 2, + Error: new Error() + }; }), "A2"); eq("File \"js_exception_catch_test.res\", line 49, characters 5-12", test(() => { - throw new Error(A, { - cause: { - RE_EXN_ID: A, - _1: 3 - } - }); + throw { + RE_EXN_ID: A, + _1: 3, + Error: new Error() + }; }), "A_any"); eq("File \"js_exception_catch_test.res\", line 50, characters 5-12", test(() => { - throw new Error(B, { - cause: { - RE_EXN_ID: B - } - }); + throw { + RE_EXN_ID: B, + Error: new Error() + }; }), "B"); eq("File \"js_exception_catch_test.res\", line 51, characters 5-12", test(() => { - throw new Error(C, { - cause: { - RE_EXN_ID: C, - _1: 1, - _2: 2 - } - }); + throw { + RE_EXN_ID: C, + _1: 1, + _2: 2, + Error: new Error() + }; }), "C"); eq("File \"js_exception_catch_test.res\", line 52, characters 5-12", test(() => { - throw new Error(C, { - cause: { - RE_EXN_ID: C, - _1: 0, - _2: 2 - } - }); + throw { + RE_EXN_ID: C, + _1: 0, + _2: 2, + Error: new Error() + }; }), "C_any"); eq("File \"js_exception_catch_test.res\", line 53, characters 5-12", test(() => { - throw new Error(new Error("x").RE_EXN_ID, { - cause: new Error("x") - }); + throw new Error("x"); }), "Js_error"); eq("File \"js_exception_catch_test.res\", line 54, characters 5-12", test(() => { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "x" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "x", + Error: new Error() + }; }), "Any"); Mt.from_pair_suites("Js_exception_catch_test", suites.contents); diff --git a/jscomp/test/js_json_test.js b/jscomp/test/js_json_test.js index e0959fb9ca..54f2384053 100644 --- a/jscomp/test/js_json_test.js +++ b/jscomp/test/js_json_test.js @@ -91,30 +91,28 @@ add_test("File \"js_json_test.res\", line 22, characters 11-18", () => { ty2._0.forEach(x => { let ty3 = Js_json.classify(x); if (typeof ty3 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 38, - 21 - ] - } - }); - } - if (ty3.TAG === "JSONNumber") { - return; - } - throw new Error("Assert_failure", { - cause: { + throw { RE_EXN_ID: "Assert_failure", _1: [ "js_json_test.res", 38, 21 - ] - } - }); + ], + Error: new Error() + }; + } + if (ty3.TAG === "JSONNumber") { + return; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 38, + 21 + ], + Error: new Error() + }; }); return { TAG: "Ok", @@ -235,16 +233,15 @@ function option_get(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 113, - 12 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 113, + 12 + ], + Error: new Error() + }; } let dict = {}; diff --git a/jscomp/test/lazy_test.js b/jscomp/test/lazy_test.js index 12d3c2aa67..4a346c49b4 100644 --- a/jscomp/test/lazy_test.js +++ b/jscomp/test/lazy_test.js @@ -50,20 +50,18 @@ let f005 = CamlinternalLazy.from_fun(() => 6); let f006 = CamlinternalLazy.from_fun(() => (() => 3)); let f007 = CamlinternalLazy.from_fun(() => { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }); function f$1() { console.log("hi"); - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let f008 = CamlinternalLazy.from_fun(() => f$1()); @@ -183,11 +181,10 @@ Mt.from_pair_suites("Lazy_test", { () => ({ TAG: "Ok", _0: !Lazy.is_val(CamlinternalLazy.from_fun(() => { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; })) }) ], diff --git a/jscomp/test/libqueue_test.js b/jscomp/test/libqueue_test.js index 693731383c..11819ab771 100644 --- a/jscomp/test/libqueue_test.js +++ b/jscomp/test/libqueue_test.js @@ -41,9 +41,7 @@ function does_raise(f, q) { if (exn.RE_EXN_ID === Queue.Empty) { return true; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -54,16 +52,15 @@ let q = { }; if (!(to_list(q) === /* [] */0 && q.length === 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 30, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 30, + 2 + ], + Error: new Error() + }; } Queue.add(1, q); @@ -72,16 +69,15 @@ if (!(Caml_obj.equal(to_list(q), { hd: 1, tl: /* [] */0 }) && q.length === 1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 32, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 32, + 2 + ], + Error: new Error() + }; } Queue.add(2, q); @@ -93,16 +89,15 @@ if (!(Caml_obj.equal(to_list(q), { tl: /* [] */0 } }) && q.length === 2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 34, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 34, + 2 + ], + Error: new Error() + }; } Queue.add(3, q); @@ -117,16 +112,15 @@ if (!(Caml_obj.equal(to_list(q), { } } }) && q.length === 3)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 36, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 36, + 2 + ], + Error: new Error() + }; } Queue.add(4, q); @@ -144,29 +138,27 @@ if (!(Caml_obj.equal(to_list(q), { } } }) && q.length === 4)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 38, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 38, + 2 + ], + Error: new Error() + }; } if (Queue.take(q) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 39, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 39, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(to_list(q), { @@ -179,29 +171,27 @@ if (!(Caml_obj.equal(to_list(q), { } } }) && q.length === 3)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 40, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 40, + 2 + ], + Error: new Error() + }; } if (Queue.take(q) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 41, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 41, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(to_list(q), { @@ -211,84 +201,78 @@ if (!(Caml_obj.equal(to_list(q), { tl: /* [] */0 } }) && q.length === 2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 42, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 42, + 2 + ], + Error: new Error() + }; } if (Queue.take(q) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 43, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 43, + 2 + ], + Error: new Error() + }; } if (!(Caml_obj.equal(to_list(q), { hd: 4, tl: /* [] */0 }) && q.length === 1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 44, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 44, + 2 + ], + Error: new Error() + }; } if (Queue.take(q) !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 45, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 45, + 2 + ], + Error: new Error() + }; } if (!(to_list(q) === /* [] */0 && q.length === 0)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 46, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 46, + 2 + ], + Error: new Error() + }; } if (!does_raise(Queue.take, q)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 47, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 47, + 2 + ], + Error: new Error() + }; } let q$1 = { @@ -300,70 +284,65 @@ let q$1 = { Queue.add(1, q$1); if (Queue.take(q$1) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 53, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 53, + 2 + ], + Error: new Error() + }; } if (!does_raise(Queue.take, q$1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 54, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 54, + 2 + ], + Error: new Error() + }; } Queue.add(2, q$1); if (Queue.take(q$1) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 56, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 56, + 2 + ], + Error: new Error() + }; } if (!does_raise(Queue.take, q$1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 57, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 57, + 2 + ], + Error: new Error() + }; } if (q$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 58, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 58, + 2 + ], + Error: new Error() + }; } let q$2 = { @@ -375,150 +354,139 @@ let q$2 = { Queue.add(1, q$2); if (Queue.peek(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 64, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 64, + 2 + ], + Error: new Error() + }; } Queue.add(2, q$2); if (Queue.peek(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 66, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 66, + 2 + ], + Error: new Error() + }; } Queue.add(3, q$2); if (Queue.peek(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 68, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 68, + 2 + ], + Error: new Error() + }; } if (Queue.peek(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 69, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 69, + 2 + ], + Error: new Error() + }; } if (Queue.take(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 70, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 70, + 2 + ], + Error: new Error() + }; } if (Queue.peek(q$2) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 71, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 71, + 2 + ], + Error: new Error() + }; } if (Queue.take(q$2) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 72, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 72, + 2 + ], + Error: new Error() + }; } if (Queue.peek(q$2) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 73, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 73, + 2 + ], + Error: new Error() + }; } if (Queue.take(q$2) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 74, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 74, + 2 + ], + Error: new Error() + }; } if (!does_raise(Queue.peek, q$2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 75, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 75, + 2 + ], + Error: new Error() + }; } if (!does_raise(Queue.peek, q$2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 76, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 76, + 2 + ], + Error: new Error() + }; } let q$3 = { @@ -534,29 +502,27 @@ for (let i = 1; i <= 10; ++i) { Queue.clear(q$3); if (q$3.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 85, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 85, + 2 + ], + Error: new Error() + }; } if (!does_raise(Queue.take, q$3)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 86, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 86, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(q$3, { @@ -564,31 +530,29 @@ if (!Caml_obj.equal(q$3, { first: "Nil", last: "Nil" })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 87, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 87, + 2 + ], + Error: new Error() + }; } Queue.add(42, q$3); if (Queue.take(q$3) !== 42) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 89, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 89, + 2 + ], + Error: new Error() + }; } let q1 = { @@ -634,16 +598,15 @@ if (!Caml_obj.equal(to_list(q1), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 98, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 98, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q2), { @@ -677,72 +640,67 @@ if (!Caml_obj.equal(to_list(q2), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 99, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 99, + 2 + ], + Error: new Error() + }; } if (q1.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 100, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 100, + 2 + ], + Error: new Error() + }; } if (q2.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 101, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 101, + 2 + ], + Error: new Error() + }; } for (let i$2 = 1; i$2 <= 10; ++i$2) { if (Queue.take(q1) !== i$2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 103, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 103, + 4 + ], + Error: new Error() + }; } } for (let i$3 = 1; i$3 <= 10; ++i$3) { if (Queue.take(q2) !== i$3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 106, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 106, + 4 + ], + Error: new Error() + }; } } @@ -754,99 +712,92 @@ let q$4 = { }; if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 112, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 112, + 2 + ], + Error: new Error() + }; } for (let i$4 = 1; i$4 <= 10; ++i$4) { Queue.add(i$4, q$4); if (q$4.length !== i$4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 115, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 115, + 4 + ], + Error: new Error() + }; } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 116, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 116, + 4 + ], + Error: new Error() + }; } } for (let i$5 = 10; i$5 >= 1; --i$5) { if (q$4.length !== i$5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 119, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 119, + 4 + ], + Error: new Error() + }; } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 120, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 120, + 4 + ], + Error: new Error() + }; } Queue.take(q$4); } if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 123, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 123, + 2 + ], + Error: new Error() + }; } if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 124, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 124, + 2 + ], + Error: new Error() + }; } let q$5 = { @@ -865,16 +816,15 @@ let i$7 = { Queue.iter(j => { if (i$7.contents !== j) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 134, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 134, + 4 + ], + Error: new Error() + }; } i$7.contents = i$7.contents + 1 | 0; }, q$5); @@ -892,109 +842,101 @@ let q2$1 = { }; if (q1$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 141, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 141, + 2 + ], + Error: new Error() + }; } if (to_list(q1$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 142, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 142, + 2 + ], + Error: new Error() + }; } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 143, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 143, + 2 + ], + Error: new Error() + }; } if (to_list(q2$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 144, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 144, + 2 + ], + Error: new Error() + }; } Queue.transfer(q1$1, q2$1); if (q1$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 146, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 146, + 2 + ], + Error: new Error() + }; } if (to_list(q1$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 147, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 147, + 2 + ], + Error: new Error() + }; } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 148, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 148, + 2 + ], + Error: new Error() + }; } if (to_list(q2$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 149, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 149, + 2 + ], + Error: new Error() + }; } let q1$2 = { @@ -1014,16 +956,15 @@ for (let i$8 = 1; i$8 <= 4; ++i$8) { } if (q1$2.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 157, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 157, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q1$2), { @@ -1039,83 +980,77 @@ if (!Caml_obj.equal(to_list(q1$2), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 158, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 158, + 2 + ], + Error: new Error() + }; } if (q2$2.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 159, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 159, + 2 + ], + Error: new Error() + }; } if (to_list(q2$2) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 160, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 160, + 2 + ], + Error: new Error() + }; } Queue.transfer(q1$2, q2$2); if (q1$2.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 162, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 162, + 2 + ], + Error: new Error() + }; } if (to_list(q1$2) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 163, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 163, + 2 + ], + Error: new Error() + }; } if (q2$2.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 164, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 164, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q2$2), { @@ -1131,16 +1066,15 @@ if (!Caml_obj.equal(to_list(q2$2), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 165, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 165, + 2 + ], + Error: new Error() + }; } let q1$3 = { @@ -1160,42 +1094,39 @@ for (let i$9 = 5; i$9 <= 8; ++i$9) { } if (q1$3.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 173, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 173, + 2 + ], + Error: new Error() + }; } if (to_list(q1$3) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 174, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 174, + 2 + ], + Error: new Error() + }; } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 175, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 175, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q2$3), { @@ -1211,57 +1142,53 @@ if (!Caml_obj.equal(to_list(q2$3), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 176, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 176, + 2 + ], + Error: new Error() + }; } Queue.transfer(q1$3, q2$3); if (q1$3.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 178, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 178, + 2 + ], + Error: new Error() + }; } if (to_list(q1$3) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 179, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 179, + 2 + ], + Error: new Error() + }; } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 180, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 180, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q2$3), { @@ -1277,16 +1204,15 @@ if (!Caml_obj.equal(to_list(q2$3), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 181, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 181, + 2 + ], + Error: new Error() + }; } let q1$4 = { @@ -1310,16 +1236,15 @@ for (let i$11 = 5; i$11 <= 8; ++i$11) { } if (q1$4.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 192, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 192, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q1$4), { @@ -1335,29 +1260,27 @@ if (!Caml_obj.equal(to_list(q1$4), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 193, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 193, + 2 + ], + Error: new Error() + }; } if (q2$4.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 194, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 194, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q2$4), { @@ -1373,57 +1296,53 @@ if (!Caml_obj.equal(to_list(q2$4), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 195, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 195, + 2 + ], + Error: new Error() + }; } Queue.transfer(q1$4, q2$4); if (q1$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 197, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 197, + 2 + ], + Error: new Error() + }; } if (to_list(q1$4) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 198, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 198, + 2 + ], + Error: new Error() + }; } if (q2$4.length !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 199, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 199, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(to_list(q2$4), { @@ -1451,16 +1370,15 @@ if (!Caml_obj.equal(to_list(q2$4), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 200, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 200, + 2 + ], + Error: new Error() + }; } console.log("OK"); diff --git a/jscomp/test/map_find_test.js b/jscomp/test/map_find_test.js index fd645f38c2..584e25c7e1 100644 --- a/jscomp/test/map_find_test.js +++ b/jscomp/test/map_find_test.js @@ -33,12 +33,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -50,12 +49,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -68,12 +66,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -85,12 +82,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, param) { @@ -143,11 +139,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -212,12 +207,11 @@ function bal$1(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -229,12 +223,11 @@ function bal$1(l, x, d, r) { if (typeof lr === "object") { return create$1(create$1(ll, lv, ld, lr.l), lr.v, lr.d, create$1(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -247,12 +240,11 @@ function bal$1(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -264,12 +256,11 @@ function bal$1(l, x, d, r) { if (typeof rl === "object") { return create$1(create$1(l, x, d, rl.l), rl.v, rl.d, create$1(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add$1(x, data, param) { @@ -322,11 +313,10 @@ function find$1(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.string_compare(x, param.v); if (c === 0) { diff --git a/jscomp/test/map_test.js b/jscomp/test/map_test.js index bd37173302..72a78eeacc 100644 --- a/jscomp/test/map_test.js +++ b/jscomp/test/map_test.js @@ -51,12 +51,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -68,12 +67,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -86,12 +84,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -103,12 +100,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty(param) { @@ -169,11 +165,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -188,11 +183,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -266,11 +260,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -374,11 +367,10 @@ function min_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -414,11 +406,10 @@ function max_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -452,12 +443,11 @@ function max_binding_opt(_param) { function remove_min_binding(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -761,16 +751,15 @@ function merge$1(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); @@ -1045,12 +1034,11 @@ function bal$1(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -1062,12 +1050,11 @@ function bal$1(l, x, d, r) { if (typeof lr === "object") { return create$1(create$1(ll, lv, ld, lr.l), lr.v, lr.d, create$1(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -1080,12 +1067,11 @@ function bal$1(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -1097,12 +1083,11 @@ function bal$1(l, x, d, r) { if (typeof rl === "object") { return create$1(create$1(l, x, d, rl.l), rl.v, rl.d, create$1(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty$1(param) { @@ -1163,11 +1148,10 @@ function find$1(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.string_compare(x, param.v); if (c === 0) { @@ -1182,11 +1166,10 @@ function find_first$1(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1260,11 +1243,10 @@ function find_last$1(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1368,11 +1350,10 @@ function min_binding$1(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1408,11 +1389,10 @@ function max_binding$1(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -1446,12 +1426,11 @@ function max_binding_opt$1(_param) { function remove_min_binding$1(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1755,16 +1734,15 @@ function merge$3(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split$1(v2, s1); diff --git a/jscomp/test/mario_game.js b/jscomp/test/mario_game.js index f1dc0788a9..778211b4a8 100644 --- a/jscomp/test/mario_game.js +++ b/jscomp/test/mario_game.js @@ -1484,12 +1484,11 @@ function game_win(ctx) { ctx.fillStyle = "white"; ctx.font = "20px 'Press Start 2P'"; ctx.fillText("You win!", 180, 128); - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Game over." - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Game over.", + Error: new Error() + }; } function game_loss(ctx) { @@ -1499,12 +1498,11 @@ function game_loss(ctx) { ctx.fillStyle = "white"; ctx.font = "20px 'Press Start 2P'"; ctx.fillText("GAME OVER. You lose!", 60, 128); - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Game over." - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Game over.", + Error: new Error() + }; } let Draw = { @@ -2464,12 +2462,11 @@ function choose_enemy_typ(typ) { case 2 : return "Goomba"; default: - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Shouldn't reach here" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Shouldn't reach here", + Error: new Error() + }; } } @@ -2489,12 +2486,11 @@ function choose_sblock_typ(typ) { case 4 : return "Ground"; default: - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Shouldn't reach here" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Shouldn't reach here", + Error: new Error() + }; } } @@ -3005,12 +3001,11 @@ function choose_block_pattern(blockw, blockh, cbx, cby, prob) { tl: /* [] */0 }; default: - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Shouldn't reach here" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Shouldn't reach here", + Error: new Error() + }; } } @@ -3279,12 +3274,11 @@ function load(param) { canvas = el; } else { console.log("cant find canvas " + canvas_id); - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "fail" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "fail", + Error: new Error() + }; } let context = canvas.getContext("2d"); document.addEventListener("keydown", keydown, true); diff --git a/jscomp/test/noassert.js b/jscomp/test/noassert.js index 249a4ce2fb..9626fa7296 100644 --- a/jscomp/test/noassert.js +++ b/jscomp/test/noassert.js @@ -3,16 +3,15 @@ function f() { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "noassert.res", - 1, - 14 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "noassert.res", + 1, + 14 + ], + Error: new Error() + }; } function h() { diff --git a/jscomp/test/ocaml_re_test.js b/jscomp/test/ocaml_re_test.js index 2b1ff3c81c..1493e8b236 100644 --- a/jscomp/test/ocaml_re_test.js +++ b/jscomp/test/ocaml_re_test.js @@ -318,12 +318,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -335,12 +334,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -353,12 +351,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -370,12 +367,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, param) { @@ -519,12 +515,11 @@ function bal$1(l, v, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -535,12 +530,11 @@ function bal$1(l, v, r) { if (typeof lr === "object") { return create$1(create$1(ll, lv, lr.l), lr.v, create$1(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -552,12 +546,11 @@ function bal$1(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -568,12 +561,11 @@ function bal$1(l, v, r) { if (typeof rl === "object") { return create$1(create$1(l, v, rl.l), rl.v, create$1(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } function add$1(x, param) { @@ -1072,16 +1064,15 @@ function split_at_match_rec(_l$p, _x) { ]; } } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 815, - 16 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 815, + 16 + ], + Error: new Error() + }; } }; } @@ -1512,9 +1503,7 @@ function find_state(re, desc) { Re_automata_State.Table.add(re.states, desc, st); return st; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1594,9 +1583,7 @@ function final(info, st, cat) { }; return res; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1616,9 +1603,7 @@ function find_initial_state(re, cat) { }; return st; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1721,11 +1706,10 @@ function trans_set(cache, cm, s) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = compare(v, param.v); if (c === 0) { @@ -1741,9 +1725,7 @@ function trans_set(cache, cm, s) { cache.contents = add(v, l, cache.contents); return l; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1882,16 +1864,15 @@ function colorize(c, regexp) { _regexp = regexp._1; continue; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2168, - 8 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 2168, + 8 + ], + Error: new Error() + }; } } }; @@ -2492,16 +2473,15 @@ function translate(ids, kind, _ign_group, ign_case, _greedy, pos, cache, c, _x) match$5[1] ]; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2402, - 80 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 2402, + 80 + ], + Error: new Error() + }; } } }; @@ -2535,30 +2515,28 @@ function case_insens(s) { function as_set(x) { if (typeof x !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "ocaml_re_test.res", - 2437, - 11 - ] - } - }); - } - if (x.TAG === "Set") { - return x._0; - } - throw new Error("Assert_failure", { - cause: { + throw { RE_EXN_ID: "Assert_failure", _1: [ "ocaml_re_test.res", 2437, 11 - ] - } - }); + ], + Error: new Error() + }; + } + if (x.TAG === "Set") { + return x._0; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 2437, + 11 + ], + Error: new Error() + }; } function handle_case(_ign_case, _x) { @@ -2756,20 +2734,18 @@ let epsilon = { function repn(r, i, j) { if (i < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Re.repn" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Re.repn", + Error: new Error() + }; } if (j !== undefined && j < i) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Re.repn" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Re.repn", + Error: new Error() + }; } return { TAG: "Repeat", @@ -2798,12 +2774,11 @@ function compl(l) { if (is_charset(r)) { return r; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Re.compl" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Re.compl", + Error: new Error() + }; } let any = { @@ -3153,12 +3128,11 @@ function exec_internal(name, posOpt, lenOpt, groups, re, s) { let pos = posOpt !== undefined ? posOpt : 0; let len = lenOpt !== undefined ? lenOpt : -1; if (pos < 0 || len < -1 || (pos + len | 0) > s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: name - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: name, + Error: new Error() + }; } let partial = false; let slen = s.length; @@ -3224,19 +3198,17 @@ function exec_internal(name, posOpt, lenOpt, groups, re, s) { function offset$1(t, i) { if (((i << 1) + 1 | 0) >= t.marks.length) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let m1 = Caml_array.get(t.marks, (i << 1)); if (m1 === -1) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let p1 = Caml_array.get(t.gpos, m1) - 1 | 0; let p2 = Caml_array.get(t.gpos, Caml_array.get(t.marks, (i << 1) + 1 | 0)) - 1 | 0; @@ -3286,12 +3258,11 @@ function posix_class_of_string(x) { return xdigit; default: let s = "Invalid pcre class: " + x; - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } } @@ -3320,19 +3291,17 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { for (let j = 0; j < len; ++j) { try { if (Caml_string.get(s$p, j) !== Caml_string.get(s, i.contents + j | 0)) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } } catch (exn) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } } i.contents = i.contents + len | 0; @@ -3342,9 +3311,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { if (exn$1.RE_EXN_ID === Pervasives.Exit) { return false; } - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } }; let get = () => { @@ -3411,30 +3378,27 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { if (accept(/* ':' */58)) { let r = regexp$p(branch()); if (!accept(/* ')' */41)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return r; } if (accept(/* '#' */35)) { return comment(); } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } let r$1 = regexp$p(branch()); if (!accept(/* ')' */41)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return { TAG: "Group", @@ -3466,11 +3430,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } if (accept(/* '\\' */92)) { if (i.contents === l) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } let c = get(); switch (c) { @@ -3484,11 +3447,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { case 55 : case 56 : case 57 : - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw { + RE_EXN_ID: Not_supported, + Error: new Error() + }; case 65 : return "Beg_of_str"; case 66 : @@ -3593,11 +3555,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { case 118 : case 120 : case 121 : - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; case 122 : return "End_of_str"; default: @@ -3608,11 +3569,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } } else { if (i.contents === l) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } let c$1 = get(); if (c$1 >= 64) { @@ -3623,25 +3583,22 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { _0: single(c$1) }; } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } if (c$1 >= 44) { if (c$1 >= 63) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return { TAG: "Set", @@ -3649,11 +3606,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } if (c$1 >= 42) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return { TAG: "Set", @@ -3683,11 +3639,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } let i$p = Math.imul(10, i$1) + (d$1 - /* '0' */48 | 0) | 0; if (i$p < i$1) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } _i = i$p; continue; @@ -3712,18 +3667,16 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { if (i$1 !== undefined) { let j = accept(/* ',' */44) ? integer() : i$1; if (!accept(/* '}' */125)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } if (j !== undefined && j < i$1) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return greedy_mod(repn(r, i$1, j)); } @@ -3732,20 +3685,18 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; let char = () => { if (i.contents === l) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } let c = get(); if (c === /* '[' */91) { if (accept(/* '=' */61)) { - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw { + RE_EXN_ID: Not_supported, + Error: new Error() + }; } if (accept(/* ':' */58)) { let compl$1 = accept(/* '^' */94); @@ -3794,22 +3745,18 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } if (!accept_s(":]")) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } let posix_class = posix_class_of_string(cls); let re = compl$1 ? compl({ @@ -3828,26 +3775,23 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } if (i.contents === l) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } let c$1 = get(); if (!accept(/* '.' */46)) { - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw { + RE_EXN_ID: Not_supported, + Error: new Error() + }; } if (!accept(/* ']' */93)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return { NAME: "Char", @@ -4014,19 +3958,17 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { case 120 : case 121 : case 122 : - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } } else { if (c$2 >= 48) { - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw { + RE_EXN_ID: Not_supported, + Error: new Error() + }; } return { NAME: "Char", @@ -4127,11 +4069,10 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; let res = regexp$p(branch()); if (i.contents !== l) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; } return res; } @@ -4174,17 +4115,15 @@ function exec(rex, pos, s) { return substr._0; } if (substr === "Failed") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let s = "a".repeat(1048575) + "b"; diff --git a/jscomp/test/offset.js b/jscomp/test/offset.js index 478ed2bf19..457a8bbe5b 100644 --- a/jscomp/test/offset.js +++ b/jscomp/test/offset.js @@ -35,12 +35,11 @@ function bal(l, v, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -51,12 +50,11 @@ function bal(l, v, r) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -68,12 +66,11 @@ function bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -84,12 +81,11 @@ function bal(l, v, r) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } function add(x, param) { @@ -173,11 +169,10 @@ function min_elt(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -207,11 +202,10 @@ function max_elt(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -239,12 +233,11 @@ function max_elt_opt(_param) { function remove_min_elt(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -658,11 +651,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = Caml.string_compare(x, v); @@ -678,11 +670,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -744,11 +735,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -955,16 +945,15 @@ function of_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l$1), l$1)[0]; } else { diff --git a/jscomp/test/pq_test.js b/jscomp/test/pq_test.js index 55344e6523..ef55e96787 100644 --- a/jscomp/test/pq_test.js +++ b/jscomp/test/pq_test.js @@ -40,11 +40,10 @@ let Queue_is_empty = /* @__PURE__ */Caml_exceptions.create("Pq_test.PrioQueue.Qu function remove_top(x) { if (typeof x !== "object") { - throw new Error(Queue_is_empty, { - cause: { - RE_EXN_ID: Queue_is_empty - } - }); + throw { + RE_EXN_ID: Queue_is_empty, + Error: new Error() + }; } let left = x._2; let tmp = x._3; @@ -84,11 +83,10 @@ function extract(x) { remove_top(x) ]; } - throw new Error(Queue_is_empty, { - cause: { - RE_EXN_ID: Queue_is_empty - } - }); + throw { + RE_EXN_ID: Queue_is_empty, + Error: new Error() + }; } let PrioQueue = { diff --git a/jscomp/test/queue_402.js b/jscomp/test/queue_402.js index c40c62a0f9..edbac77196 100644 --- a/jscomp/test/queue_402.js +++ b/jscomp/test/queue_402.js @@ -40,22 +40,20 @@ function add(x, q) { function peek(q) { if (q.length === 0) { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } return q.tail.next.content; } function take(q) { if (q.length === 0) { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } q.length = q.length - 1 | 0; let tail = q.tail; diff --git a/jscomp/test/raw_hash_tbl_bench.js b/jscomp/test/raw_hash_tbl_bench.js index 0e1650354a..f8de383cdf 100644 --- a/jscomp/test/raw_hash_tbl_bench.js +++ b/jscomp/test/raw_hash_tbl_bench.js @@ -10,16 +10,15 @@ function bench() { } for (let i$1 = 0; i$1 <= 1000000; ++i$1) { if (!Hashtbl.mem(table, i$1)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "raw_hash_tbl_bench.res", - 8, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "raw_hash_tbl_bench.res", + 8, + 4 + ], + Error: new Error() + }; } } diff --git a/jscomp/test/rbset.js b/jscomp/test/rbset.js index 559c1cfe84..ceb920a14c 100644 --- a/jscomp/test/rbset.js +++ b/jscomp/test/rbset.js @@ -265,16 +265,15 @@ function unbalanced_left(x) { } } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 64, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 64, + 9 + ], + Error: new Error() + }; } function unbalanced_right(x) { @@ -335,16 +334,15 @@ function unbalanced_right(x) { } } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 75, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 75, + 9 + ], + Error: new Error() + }; } function lbalance(x1, x2, x3) { @@ -560,16 +558,15 @@ function add(x, s) { function remove_min(x) { if (typeof x !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 138, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 138, + 4 + ], + Error: new Error() + }; } let c = x._0; if (c === "Black") { @@ -597,16 +594,15 @@ function remove_min(x) { false ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 138, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 138, + 4 + ], + Error: new Error() + }; } } else { diff --git a/jscomp/test/reactDOMRe.js b/jscomp/test/reactDOMRe.js index e438f9ee76..dee8919f57 100644 --- a/jscomp/test/reactDOMRe.js +++ b/jscomp/test/reactDOMRe.js @@ -69,12 +69,11 @@ function hydrateToElementWithClassName(reactElement, className) { function hydrateToElementWithId(reactElement, id) { let element = document.getElementById(id); if (element == null) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "ReactDOMRe.hydrateToElementWithId : no element of id " + (id + " found in the HTML.") - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "ReactDOMRe.hydrateToElementWithId : no element of id " + (id + " found in the HTML."), + Error: new Error() + }; } ReactDom.hydrate(reactElement, element); } diff --git a/jscomp/test/rec_module_test.js b/jscomp/test/rec_module_test.js index eeeeb1eb4c..93c8ff239d 100644 --- a/jscomp/test/rec_module_test.js +++ b/jscomp/test/rec_module_test.js @@ -214,12 +214,11 @@ function bal(l, v, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -230,12 +229,11 @@ function bal(l, v, r) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -247,12 +245,11 @@ function bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -263,12 +260,11 @@ function bal(l, v, r) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } function add(x, param) { @@ -352,11 +348,10 @@ function min_elt(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -386,11 +381,10 @@ function max_elt(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -418,12 +412,11 @@ function max_elt_opt(_param) { function remove_min_elt(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -837,11 +830,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = AAA.compare(x, v); @@ -857,11 +849,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -923,11 +914,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1134,16 +1124,15 @@ function of_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l$1), l$1)[0]; } else { diff --git a/jscomp/test/recmodule.js b/jscomp/test/recmodule.js index c940c8ea14..f500c27bd8 100644 --- a/jscomp/test/recmodule.js +++ b/jscomp/test/recmodule.js @@ -34,16 +34,15 @@ let Adapter = { function MakeLayer$2(Deps) { let presentJson = (json, status) => { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "recmodule.res", - 60, - 41 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "recmodule.res", + 60, + 41 + ], + Error: new Error() + }; }; let routes = () => [[ "/lights", @@ -108,16 +107,15 @@ let U = Caml_module.init_mod([ }); function presentJson(json, status) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "recmodule.res", - 60, - 41 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "recmodule.res", + 60, + 41 + ], + Error: new Error() + }; } function routes() { diff --git a/jscomp/test/record_extension_test.js b/jscomp/test/record_extension_test.js index dedeabf26c..9a01bc12ee 100644 --- a/jscomp/test/record_extension_test.js +++ b/jscomp/test/record_extension_test.js @@ -97,32 +97,29 @@ function u(f) { } eq("File \"record_extension_test.res\", line 59, characters 3-10", u(() => { - throw new Error(A, { - cause: { - RE_EXN_ID: A, - name: 1, - x: 1 - } - }); + throw { + RE_EXN_ID: A, + name: 1, + x: 1, + Error: new Error() + }; }), 2); eq("File \"record_extension_test.res\", line 60, characters 3-10", u(() => { - throw new Error(B, { - cause: { - RE_EXN_ID: B, - _1: 1, - _2: 2 - } - }); + throw { + RE_EXN_ID: B, + _1: 1, + _2: 2, + Error: new Error() + }; }), 3); eq("File \"record_extension_test.res\", line 61, characters 3-10", u(() => { - throw new Error(C, { - cause: { - RE_EXN_ID: C, - name: 4 - } - }); + throw { + RE_EXN_ID: C, + name: 4, + Error: new Error() + }; }), 4); Mt.from_pair_suites("File \"record_extension_test.res\", line 63, characters 29-36", suites.contents); diff --git a/jscomp/test/recursive_module.js b/jscomp/test/recursive_module.js index 70ee5b42ee..25f412c863 100644 --- a/jscomp/test/recursive_module.js +++ b/jscomp/test/recursive_module.js @@ -100,9 +100,7 @@ try { if (exn.RE_EXN_ID === Lazy.Undefined) { tmp = -1; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -173,9 +171,7 @@ try { if (exn$1.RE_EXN_ID === "Undefined_recursive_module") { tmp$1 = 4; } else { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } diff --git a/jscomp/test/recursive_records_test.js b/jscomp/test/recursive_records_test.js index 61816cb5d4..20b542d691 100644 --- a/jscomp/test/recursive_records_test.js +++ b/jscomp/test/recursive_records_test.js @@ -68,16 +68,15 @@ function tl_exn(x) { if (typeof x === "object") { return x.next; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "recursive_records_test.res", - 49, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "recursive_records_test.res", + 49, + 11 + ], + Error: new Error() + }; } eq("File \"recursive_records_test.res\", line 54, characters 5-12", (hd(rec_cell2) + hd(tl_exn(rec_cell2)) | 0) + hd(tl_exn(tl_exn(rec_cell2))) | 0, 9); diff --git a/jscomp/test/return_check.js b/jscomp/test/return_check.js index ab7805940a..b4992c4363 100644 --- a/jscomp/test/return_check.js +++ b/jscomp/test/return_check.js @@ -18,16 +18,15 @@ function f_undefined(xs, i) { if (k !== undefined) { return k; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "return_check.res", - 23, - 12 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "return_check.res", + 23, + 12 + ], + Error: new Error() + }; } function f_escaped_not(xs, i) { @@ -60,16 +59,15 @@ function f_null(xs, i) { if (k !== null) { return k; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "return_check.res", - 51, - 12 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "return_check.res", + 51, + 12 + ], + Error: new Error() + }; } function f_null_undefined(xs, i) { @@ -77,16 +75,15 @@ function f_null_undefined(xs, i) { if (!(k == null)) { return k; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "return_check.res", - 59, - 12 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "return_check.res", + 59, + 12 + ], + Error: new Error() + }; } exports.test = test; diff --git a/jscomp/test/set_gen.js b/jscomp/test/set_gen.js index d5e26c887a..26eb922993 100644 --- a/jscomp/test/set_gen.js +++ b/jscomp/test/set_gen.js @@ -35,11 +35,10 @@ function min_elt(_x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -54,11 +53,10 @@ function max_elt(_x) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = x._2; if (typeof r !== "object") { @@ -208,19 +206,17 @@ function check_height_and_diff(x) { let hl = check_height_and_diff(x._0); let hr = check_height_and_diff(x._2); if (h !== (max_int_2(hl, hr) + 1 | 0)) { - throw new Error(Height_invariant_broken, { - cause: { - RE_EXN_ID: Height_invariant_broken - } - }); + throw { + RE_EXN_ID: Height_invariant_broken, + Error: new Error() + }; } let diff = Pervasives.abs(hl - hr | 0); if (diff > 2) { - throw new Error(Height_diff_borken, { - cause: { - RE_EXN_ID: Height_diff_borken - } - }); + throw { + RE_EXN_ID: Height_diff_borken, + Error: new Error() + }; } return h; } @@ -250,16 +246,15 @@ function internal_bal(l, v, r) { hr = typeof r !== "object" ? 0 : r._3; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set_gen.res", - 278, - 15 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 278, + 15 + ], + Error: new Error() + }; } let lr = l._2; let lv = l._1; @@ -270,16 +265,15 @@ function internal_bal(l, v, r) { if (typeof lr === "object") { return create(create(ll, lv, lr._0), lr._1, create(lr._2, v, r)); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set_gen.res", - 288, - 19 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 288, + 19 + ], + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -291,16 +285,15 @@ function internal_bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set_gen.res", - 300, - 15 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 300, + 15 + ], + Error: new Error() + }; } let rr = r._2; let rv = r._1; @@ -311,26 +304,24 @@ function internal_bal(l, v, r) { if (typeof rl === "object") { return create(create(l, v, rl._0), rl._1, create(rl._2, rv, rr)); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set_gen.res", - 306, - 19 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 306, + 19 + ], + Error: new Error() + }; } function remove_min_elt(x) { if (typeof x !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -538,16 +529,15 @@ function of_sorted_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set_gen.res", - 447, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 447, + 18 + ], + Error: new Error() + }; }; return sub(List.length(l), l)[0]; } diff --git a/jscomp/test/sexp.js b/jscomp/test/sexp.js index 3ad3c16eae..92adfe4154 100644 --- a/jscomp/test/sexp.js +++ b/jscomp/test/sexp.js @@ -477,12 +477,11 @@ function get_exn(e) { if (e !== undefined) { return Caml_option.valFromOption(e); } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "CCSexp.Traverse.get_exn" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "CCSexp.Traverse.get_exn", + Error: new Error() + }; } let of_unit = { diff --git a/jscomp/test/sexpm.js b/jscomp/test/sexpm.js index ee81d710c7..23f147a379 100644 --- a/jscomp/test/sexpm.js +++ b/jscomp/test/sexpm.js @@ -22,18 +22,16 @@ function _must_escape(s) { if (c !== 92) { exit = 1; } else { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } } else { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } } else if (c >= 11) { if (c >= 32) { @@ -50,31 +48,28 @@ function _must_escape(s) { case 34 : case 40 : case 41 : - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } } else { exit = 1; } } else { if (c >= 9) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } exit = 1; } if (exit === 1 && c > 127) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw { + RE_EXN_ID: Pervasives.Exit, + Error: new Error() + }; } } @@ -84,9 +79,7 @@ function _must_escape(s) { if (exn.RE_EXN_ID === Pervasives.Exit) { return true; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -161,16 +154,15 @@ function _refill(t, k_succ, k_fail) { function _get(t) { if (t.i >= t.len) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "sexpm.res", - 111, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "sexpm.res", + 111, + 4 + ], + Error: new Error() + }; } let c = Caml_bytes.get(t.buf, t.i); t.i = t.i + 1 | 0; @@ -232,16 +224,15 @@ function expr_starting_with(c, k, t) { if (c >= 32) { switch (c) { case 32 : - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "sexpm.res", - 152, - 27 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "sexpm.res", + 152, + 27 + ], + Error: new Error() + }; case 34 : return quoted(k, t); case 33 : @@ -259,16 +250,15 @@ function expr_starting_with(c, k, t) { } } else if (c >= 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "sexpm.res", - 152, - 27 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "sexpm.res", + 152, + 27 + ], + Error: new Error() + }; } Buffer.add_char(t.atom, c); return atom(k, t); diff --git a/jscomp/test/stack_comp_test.js b/jscomp/test/stack_comp_test.js index e48789bbee..7a41fdc6ec 100644 --- a/jscomp/test/stack_comp_test.js +++ b/jscomp/test/stack_comp_test.js @@ -64,9 +64,7 @@ function does_raise(f, s) { if (exn.RE_EXN_ID === Stack.Empty) { return true; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/stream_parser_test.js b/jscomp/test/stream_parser_test.js index 2c52c45039..21d927d1a4 100644 --- a/jscomp/test/stream_parser_test.js +++ b/jscomp/test/stream_parser_test.js @@ -40,37 +40,33 @@ function parse(token) { if (match._0 === ")") { return v; } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "Unbalanced parens" - } - }); - } - throw new Error(Parse_error, { - cause: { + throw { RE_EXN_ID: Parse_error, - _1: "Unbalanced parens" - } - }); + _1: "Unbalanced parens", + Error: new Error() + }; + } + throw { + RE_EXN_ID: Parse_error, + _1: "Unbalanced parens", + Error: new Error() + }; } Queue.push(n, look_ahead); - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "unexpected token" - } - }); + throw { + RE_EXN_ID: Parse_error, + _1: "unexpected token", + Error: new Error() + }; case "Int" : return n._0; default: Queue.push(n, look_ahead); - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "unexpected token" - } - }); + throw { + RE_EXN_ID: Parse_error, + _1: "unexpected token", + Error: new Error() + }; } }; let parse_term = () => parse_term_aux(parse_atom()); @@ -173,35 +169,31 @@ function l_parse(token) { if (t._0 === ")") { return v; } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "Unbalanced )" - } - }); - } - throw new Error(Parse_error, { - cause: { + throw { RE_EXN_ID: Parse_error, - _1: "Unbalanced )" - } - }); - } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "Unexpected token" + _1: "Unbalanced )", + Error: new Error() + }; } - }); + throw { + RE_EXN_ID: Parse_error, + _1: "Unbalanced )", + Error: new Error() + }; + } + throw { + RE_EXN_ID: Parse_error, + _1: "Unexpected token", + Error: new Error() + }; case "Int" : return i._0; default: - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "Unexpected token" - } - }); + throw { + RE_EXN_ID: Parse_error, + _1: "Unexpected token", + Error: new Error() + }; } }; let parse_f_aux = _a => { diff --git a/jscomp/test/string_set.js b/jscomp/test/string_set.js index 75578cd7f2..13db6739ce 100644 --- a/jscomp/test/string_set.js +++ b/jscomp/test/string_set.js @@ -223,11 +223,10 @@ function find(x, _tree) { while (true) { let tree = _tree; if (typeof tree !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = tree._1; let c = Caml.string_compare(x, v); diff --git a/jscomp/test/string_test.js b/jscomp/test/string_test.js index ecfd814856..5922bf6be3 100644 --- a/jscomp/test/string_test.js +++ b/jscomp/test/string_test.js @@ -72,9 +72,7 @@ function rev_split_by_char(c, s) { tl: l }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; return loop(0, /* [] */0); @@ -102,9 +100,7 @@ function xsplit(delim, s) { tl: l }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } let l_0 = $$String.sub(s, i$p + 1 | 0, (x - i$p | 0) - 1 | 0); let l$1 = { diff --git a/jscomp/test/stringmatch_test.js b/jscomp/test/stringmatch_test.js index e9632da06a..f517fd954e 100644 --- a/jscomp/test/stringmatch_test.js +++ b/jscomp/test/stringmatch_test.js @@ -11,42 +11,39 @@ function tst01(s) { } if (tst01("") !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 22, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 22, + 2 + ], + Error: new Error() + }; } if (tst01("\x00\x00\x00\x03") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 23, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 23, + 2 + ], + Error: new Error() + }; } if (tst01("\x00\x00\x00\x00\x00\x00\x00\x07") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 24, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 24, + 2 + ], + Error: new Error() + }; } function tst02(s) { @@ -55,28 +52,26 @@ function tst02(s) { if (len >= 0) { return 1; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 33, - 21 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 33, + 21 + ], + Error: new Error() + }; } if (len === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 35, - 21 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 35, + 21 + ], + Error: new Error() + }; } if (s === "A") { return 2; @@ -86,68 +81,63 @@ function tst02(s) { } if (tst02("") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 42, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 42, + 2 + ], + Error: new Error() + }; } if (tst02("A") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 43, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 43, + 2 + ], + Error: new Error() + }; } if (tst02("B") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 44, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 44, + 2 + ], + Error: new Error() + }; } if (tst02("\x00\x00\x00\x00\x00\x00\x00\x07") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 45, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 45, + 2 + ], + Error: new Error() + }; } if (tst02("\x00\x00\x00\x03") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 46, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 46, + 2 + ], + Error: new Error() + }; } function tst03(s) { @@ -206,627 +196,579 @@ function tst03(s) { } if (tst03("get_const") !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 131, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 131, + 2 + ], + Error: new Error() + }; } if (tst03("set_congt") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 132, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 132, + 2 + ], + Error: new Error() + }; } if (tst03("get_var") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 133, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 133, + 2 + ], + Error: new Error() + }; } if (tst03("gat_ver") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 134, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 134, + 2 + ], + Error: new Error() + }; } if (tst03("get_env") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 135, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 135, + 2 + ], + Error: new Error() + }; } if (tst03("get_env") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 136, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 136, + 2 + ], + Error: new Error() + }; } if (tst03("get_meth") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 137, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 137, + 2 + ], + Error: new Error() + }; } if (tst03("met_geth") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 138, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 138, + 2 + ], + Error: new Error() + }; } if (tst03("set_var") !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 139, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 139, + 2 + ], + Error: new Error() + }; } if (tst03("sev_tar") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 140, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 140, + 2 + ], + Error: new Error() + }; } if (tst03("app_const") !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 141, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 141, + 2 + ], + Error: new Error() + }; } if (tst03("ppa_const") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 142, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 142, + 2 + ], + Error: new Error() + }; } if (tst03("app_var") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 143, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 143, + 2 + ], + Error: new Error() + }; } if (tst03("app_var") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 144, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 144, + 2 + ], + Error: new Error() + }; } if (tst03("app_env") !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 145, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 145, + 2 + ], + Error: new Error() + }; } if (tst03("epp_anv") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 146, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 146, + 2 + ], + Error: new Error() + }; } if (tst03("app_meth") !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 147, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 147, + 2 + ], + Error: new Error() + }; } if (tst03("atp_meph") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 148, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 148, + 2 + ], + Error: new Error() + }; } if (tst03("app_const_const") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 149, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 149, + 2 + ], + Error: new Error() + }; } if (tst03("app_const_const") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 150, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 150, + 2 + ], + Error: new Error() + }; } if (tst03("app_const_var") !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 151, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 151, + 2 + ], + Error: new Error() + }; } if (tst03("atp_consp_var") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 152, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 152, + 2 + ], + Error: new Error() + }; } if (tst03("app_const_env") !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 153, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 153, + 2 + ], + Error: new Error() + }; } if (tst03("app_constne_v") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 154, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 154, + 2 + ], + Error: new Error() + }; } if (tst03("app_const_meth") !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 155, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 155, + 2 + ], + Error: new Error() + }; } if (tst03("spp_conat_meth") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 156, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 156, + 2 + ], + Error: new Error() + }; } if (tst03("app_var_const") !== 13) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 157, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 157, + 2 + ], + Error: new Error() + }; } if (tst03("app_va_rconst") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 158, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 158, + 2 + ], + Error: new Error() + }; } if (tst03("app_env_const") !== 14) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 159, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 159, + 2 + ], + Error: new Error() + }; } if (tst03("app_env_const") !== 14) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 160, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 160, + 2 + ], + Error: new Error() + }; } if (tst03("app_meth_const") !== 15) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 161, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 161, + 2 + ], + Error: new Error() + }; } if (tst03("app_teth_consm") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 162, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 162, + 2 + ], + Error: new Error() + }; } if (tst03("meth_app_const") !== 16) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 163, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 163, + 2 + ], + Error: new Error() + }; } if (tst03("math_epp_const") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 164, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 164, + 2 + ], + Error: new Error() + }; } if (tst03("meth_app_var") !== 17) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 165, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 165, + 2 + ], + Error: new Error() + }; } if (tst03("meth_app_var") !== 17) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 166, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 166, + 2 + ], + Error: new Error() + }; } if (tst03("meth_app_env") !== 18) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 167, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 167, + 2 + ], + Error: new Error() + }; } if (tst03("eeth_app_mnv") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 168, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 168, + 2 + ], + Error: new Error() + }; } if (tst03("meth_app_meth") !== 19) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 169, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 169, + 2 + ], + Error: new Error() + }; } if (tst03("meth_apt_meph") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 170, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 170, + 2 + ], + Error: new Error() + }; } if (tst03("send_const") !== 20) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 171, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 171, + 2 + ], + Error: new Error() + }; } if (tst03("tend_conss") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 172, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 172, + 2 + ], + Error: new Error() + }; } if (tst03("send_var") !== 21) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 173, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 173, + 2 + ], + Error: new Error() + }; } if (tst03("serd_van") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 174, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 174, + 2 + ], + Error: new Error() + }; } if (tst03("send_env") !== 22) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 175, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 175, + 2 + ], + Error: new Error() + }; } if (tst03("sen_denv") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 176, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 176, + 2 + ], + Error: new Error() + }; } if (tst03("send_meth") !== 23) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 177, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 177, + 2 + ], + Error: new Error() + }; } if (tst03("tend_mesh") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 178, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 178, + 2 + ], + Error: new Error() + }; } function tst04(s) { @@ -861,250 +803,231 @@ function tst04(s) { } if (tst04("AAAAAAAA") !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 215, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 215, + 2 + ], + Error: new Error() + }; } if (tst04("AAAAAAAAAAAAAAAA") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 216, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 216, + 2 + ], + Error: new Error() + }; } if (tst04("AAAAAAAAAAAAAAAAAAAAAAAA") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 217, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 217, + 2 + ], + Error: new Error() + }; } if (tst04("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 218, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 218, + 2 + ], + Error: new Error() + }; } if (tst04("BBBBBBBB") !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 219, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 219, + 2 + ], + Error: new Error() + }; } if (tst04("BBBBBBBBBBBBBBBB") !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 220, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 220, + 2 + ], + Error: new Error() + }; } if (tst04("BBBBBBBBBBBBBBBBBBBBBBBB") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 221, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 221, + 2 + ], + Error: new Error() + }; } if (tst04("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 222, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 222, + 2 + ], + Error: new Error() + }; } if (tst04("CCCCCCCC") !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 223, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 223, + 2 + ], + Error: new Error() + }; } if (tst04("CCCCCCCCCCCCCCCC") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 224, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 224, + 2 + ], + Error: new Error() + }; } if (tst04("CCCCCCCCCCCCCCCCCCCCCCCC") !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 225, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 225, + 2 + ], + Error: new Error() + }; } if (tst04("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC") !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 226, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 226, + 2 + ], + Error: new Error() + }; } if (tst04("") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 227, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 227, + 2 + ], + Error: new Error() + }; } if (tst04("DDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 228, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 228, + 2 + ], + Error: new Error() + }; } if (tst04("DDDDDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 229, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 229, + 2 + ], + Error: new Error() + }; } if (tst04("AAADDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 230, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 230, + 2 + ], + Error: new Error() + }; } if (tst04("AAAAAAADDDDDDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 231, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 231, + 2 + ], + Error: new Error() + }; } if (tst04("AAAAAAADDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 232, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 232, + 2 + ], + Error: new Error() + }; } if (tst04("AAAAAAAAAAAAAAADDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 233, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 233, + 2 + ], + Error: new Error() + }; } function tst05(s) { @@ -1141,289 +1064,267 @@ function tst05(s) { } if (tst05("AAA") !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 272, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 272, + 2 + ], + Error: new Error() + }; } if (tst05("AAAA") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 273, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 273, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAA") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 274, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 274, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAA") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 275, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 275, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAAA") !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 276, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 276, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAAAAAAAA") !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 277, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 277, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAAAAAAAAAAAA") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 278, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 278, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAAAAAAAAAAAAAAAA") !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 279, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 279, + 2 + ], + Error: new Error() + }; } if (tst05("BBB") !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 280, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 280, + 2 + ], + Error: new Error() + }; } if (tst05("BBBB") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 281, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 281, + 2 + ], + Error: new Error() + }; } if (tst05("BBBBB") !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 282, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 282, + 2 + ], + Error: new Error() + }; } if (tst05("BBBBBB") !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 283, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 283, + 2 + ], + Error: new Error() + }; } if (tst05("BBBBBBB") !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 284, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 284, + 2 + ], + Error: new Error() + }; } if (tst05("") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 285, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 285, + 2 + ], + Error: new Error() + }; } if (tst05("AAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 286, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 286, + 2 + ], + Error: new Error() + }; } if (tst05("AAAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 287, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 287, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 288, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 288, + 2 + ], + Error: new Error() + }; } if (tst05("AAAAAAAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 289, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 289, + 2 + ], + Error: new Error() + }; } if (tst05("BBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 290, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 290, + 2 + ], + Error: new Error() + }; } if (tst05("BBBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 291, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 291, + 2 + ], + Error: new Error() + }; } if (tst05("BBBBBBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 292, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 292, + 2 + ], + Error: new Error() + }; } if (tst05("BBBBBBBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 293, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 293, + 2 + ], + Error: new Error() + }; } let s00 = "and"; @@ -1986,2408 +1887,2223 @@ function tst06(s) { } if (tst06(s00) !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 582, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 582, + 2 + ], + Error: new Error() + }; } if (tst06(t00) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 583, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 583, + 2 + ], + Error: new Error() + }; } if (tst06(s01) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 584, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 584, + 2 + ], + Error: new Error() + }; } if (tst06(t01) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 585, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 585, + 2 + ], + Error: new Error() + }; } if (tst06(s02) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 586, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 586, + 2 + ], + Error: new Error() + }; } if (tst06(t02) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 587, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 587, + 2 + ], + Error: new Error() + }; } if (tst06(s03) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 588, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 588, + 2 + ], + Error: new Error() + }; } if (tst06(t03) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 589, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 589, + 2 + ], + Error: new Error() + }; } if (tst06(s04) !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 590, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 590, + 2 + ], + Error: new Error() + }; } if (tst06(t04) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 591, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 591, + 2 + ], + Error: new Error() + }; } if (tst06(s05) !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 592, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 592, + 2 + ], + Error: new Error() + }; } if (tst06(t05) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 593, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 593, + 2 + ], + Error: new Error() + }; } if (tst06(s06) !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 594, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 594, + 2 + ], + Error: new Error() + }; } if (tst06(t06) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 595, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 595, + 2 + ], + Error: new Error() + }; } if (tst06(s07) !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 596, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 596, + 2 + ], + Error: new Error() + }; } if (tst06(t07) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 597, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 597, + 2 + ], + Error: new Error() + }; } if (tst06(s08) !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 598, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 598, + 2 + ], + Error: new Error() + }; } if (tst06(t08) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 599, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 599, + 2 + ], + Error: new Error() + }; } if (tst06(s09) !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 600, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 600, + 2 + ], + Error: new Error() + }; } if (tst06(t09) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 601, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 601, + 2 + ], + Error: new Error() + }; } if (tst06(s10) !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 602, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 602, + 2 + ], + Error: new Error() + }; } if (tst06(t10) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 603, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 603, + 2 + ], + Error: new Error() + }; } if (tst06(s11) !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 604, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 604, + 2 + ], + Error: new Error() + }; } if (tst06(t11) !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 605, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 605, + 2 + ], + Error: new Error() + }; } if (tst06(s12) !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 606, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 606, + 2 + ], + Error: new Error() + }; } if (tst06(t12) !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 607, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 607, + 2 + ], + Error: new Error() + }; } if (tst06(s13) !== 13) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 608, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 608, + 2 + ], + Error: new Error() + }; } if (tst06(t13) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 609, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 609, + 2 + ], + Error: new Error() + }; } if (tst06(s14) !== 14) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 610, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 610, + 2 + ], + Error: new Error() + }; } if (tst06(t14) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 611, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 611, + 2 + ], + Error: new Error() + }; } if (tst06(s15) !== 15) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 612, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 612, + 2 + ], + Error: new Error() + }; } if (tst06(t15) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 613, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 613, + 2 + ], + Error: new Error() + }; } if (tst06(s16) !== 16) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 614, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 614, + 2 + ], + Error: new Error() + }; } if (tst06(t16) !== 16) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 615, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 615, + 2 + ], + Error: new Error() + }; } if (tst06(s17) !== 17) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 616, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 616, + 2 + ], + Error: new Error() + }; } if (tst06(t17) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 617, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 617, + 2 + ], + Error: new Error() + }; } if (tst06(s18) !== 18) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 618, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 618, + 2 + ], + Error: new Error() + }; } if (tst06(t18) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 619, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 619, + 2 + ], + Error: new Error() + }; } if (tst06(s19) !== 19) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 620, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 620, + 2 + ], + Error: new Error() + }; } if (tst06(t19) !== 19) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 621, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 621, + 2 + ], + Error: new Error() + }; } if (tst06(s20) !== 20) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 622, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 622, + 2 + ], + Error: new Error() + }; } if (tst06(t20) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 623, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 623, + 2 + ], + Error: new Error() + }; } if (tst06(s21) !== 21) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 624, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 624, + 2 + ], + Error: new Error() + }; } if (tst06(t21) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 625, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 625, + 2 + ], + Error: new Error() + }; } if (tst06(s22) !== 22) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 626, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 626, + 2 + ], + Error: new Error() + }; } if (tst06(t22) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 627, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 627, + 2 + ], + Error: new Error() + }; } if (tst06(s23) !== 23) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 628, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 628, + 2 + ], + Error: new Error() + }; } if (tst06(t23) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 629, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 629, + 2 + ], + Error: new Error() + }; } if (tst06(s24) !== 24) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 630, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 630, + 2 + ], + Error: new Error() + }; } if (tst06(t24) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 631, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 631, + 2 + ], + Error: new Error() + }; } if (tst06(s25) !== 25) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 632, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 632, + 2 + ], + Error: new Error() + }; } if (tst06(t25) !== 25) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 633, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 633, + 2 + ], + Error: new Error() + }; } if (tst06(s26) !== 26) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 634, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 634, + 2 + ], + Error: new Error() + }; } if (tst06(t26) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 635, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 635, + 2 + ], + Error: new Error() + }; } if (tst06(s27) !== 27) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 636, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 636, + 2 + ], + Error: new Error() + }; } if (tst06(t27) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 637, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 637, + 2 + ], + Error: new Error() + }; } if (tst06(s28) !== 28) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 638, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 638, + 2 + ], + Error: new Error() + }; } if (tst06(t28) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 639, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 639, + 2 + ], + Error: new Error() + }; } if (tst06(s29) !== 29) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 640, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 640, + 2 + ], + Error: new Error() + }; } if (tst06(t29) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 641, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 641, + 2 + ], + Error: new Error() + }; } if (tst06(s30) !== 30) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 642, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 642, + 2 + ], + Error: new Error() + }; } if (tst06(t30) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 643, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 643, + 2 + ], + Error: new Error() + }; } if (tst06(s31) !== 31) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 644, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 644, + 2 + ], + Error: new Error() + }; } if (tst06(t31) !== 31) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 645, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 645, + 2 + ], + Error: new Error() + }; } if (tst06(s32) !== 32) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 646, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 646, + 2 + ], + Error: new Error() + }; } if (tst06(t32) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 647, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 647, + 2 + ], + Error: new Error() + }; } if (tst06(s33) !== 33) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 648, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 648, + 2 + ], + Error: new Error() + }; } if (tst06(t33) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 649, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 649, + 2 + ], + Error: new Error() + }; } if (tst06(s34) !== 34) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 650, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 650, + 2 + ], + Error: new Error() + }; } if (tst06(t34) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 651, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 651, + 2 + ], + Error: new Error() + }; } if (tst06(s35) !== 35) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 652, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 652, + 2 + ], + Error: new Error() + }; } if (tst06(t35) !== 35) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 653, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 653, + 2 + ], + Error: new Error() + }; } if (tst06(s36) !== 36) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 654, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 654, + 2 + ], + Error: new Error() + }; } if (tst06(t36) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 655, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 655, + 2 + ], + Error: new Error() + }; } if (tst06(s37) !== 37) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 656, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 656, + 2 + ], + Error: new Error() + }; } if (tst06(t37) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 657, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 657, + 2 + ], + Error: new Error() + }; } if (tst06(s38) !== 38) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 658, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 658, + 2 + ], + Error: new Error() + }; } if (tst06(t38) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 659, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 659, + 2 + ], + Error: new Error() + }; } if (tst06(s39) !== 39) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 660, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 660, + 2 + ], + Error: new Error() + }; } if (tst06(t39) !== 39) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 661, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 661, + 2 + ], + Error: new Error() + }; } if (tst06(s40) !== 40) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 662, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 662, + 2 + ], + Error: new Error() + }; } if (tst06(t40) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 663, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 663, + 2 + ], + Error: new Error() + }; } if (tst06(s41) !== 41) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 664, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 664, + 2 + ], + Error: new Error() + }; } if (tst06(t41) !== 41) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 665, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 665, + 2 + ], + Error: new Error() + }; } if (tst06(s42) !== 42) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 666, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 666, + 2 + ], + Error: new Error() + }; } if (tst06(t42) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 667, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 667, + 2 + ], + Error: new Error() + }; } if (tst06(s43) !== 43) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 668, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 668, + 2 + ], + Error: new Error() + }; } if (tst06(t43) !== 43) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 669, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 669, + 2 + ], + Error: new Error() + }; } if (tst06(s44) !== 44) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 670, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 670, + 2 + ], + Error: new Error() + }; } if (tst06(t44) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 671, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 671, + 2 + ], + Error: new Error() + }; } if (tst06(s45) !== 45) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 672, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 672, + 2 + ], + Error: new Error() + }; } if (tst06(t45) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 673, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 673, + 2 + ], + Error: new Error() + }; } if (tst06(s46) !== 46) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 674, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 674, + 2 + ], + Error: new Error() + }; } if (tst06(t46) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 675, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 675, + 2 + ], + Error: new Error() + }; } if (tst06(s47) !== 47) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 676, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 676, + 2 + ], + Error: new Error() + }; } if (tst06(t47) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 677, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 677, + 2 + ], + Error: new Error() + }; } if (tst06(s48) !== 48) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 678, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 678, + 2 + ], + Error: new Error() + }; } if (tst06(t48) !== 48) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 679, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 679, + 2 + ], + Error: new Error() + }; } if (tst06(s49) !== 49) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 680, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 680, + 2 + ], + Error: new Error() + }; } if (tst06(t49) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 681, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 681, + 2 + ], + Error: new Error() + }; } if (tst06(s50) !== 50) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 682, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 682, + 2 + ], + Error: new Error() + }; } if (tst06(t50) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 683, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 683, + 2 + ], + Error: new Error() + }; } if (tst06(s51) !== 51) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 684, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 684, + 2 + ], + Error: new Error() + }; } if (tst06(t51) !== 51) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 685, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 685, + 2 + ], + Error: new Error() + }; } if (tst06(s52) !== 52) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 686, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 686, + 2 + ], + Error: new Error() + }; } if (tst06(t52) !== 52) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 687, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 687, + 2 + ], + Error: new Error() + }; } if (tst06(s53) !== 53) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 688, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 688, + 2 + ], + Error: new Error() + }; } if (tst06(t53) !== 53) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 689, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 689, + 2 + ], + Error: new Error() + }; } if (tst06(s54) !== 54) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 690, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 690, + 2 + ], + Error: new Error() + }; } if (tst06(t54) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 691, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 691, + 2 + ], + Error: new Error() + }; } if (tst06(s55) !== 55) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 692, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 692, + 2 + ], + Error: new Error() + }; } if (tst06(t55) !== 55) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 693, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 693, + 2 + ], + Error: new Error() + }; } if (tst06(s56) !== 56) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 694, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 694, + 2 + ], + Error: new Error() + }; } if (tst06(t56) !== 56) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 695, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 695, + 2 + ], + Error: new Error() + }; } if (tst06(s57) !== 57) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 696, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 696, + 2 + ], + Error: new Error() + }; } if (tst06(t57) !== 57) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 697, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 697, + 2 + ], + Error: new Error() + }; } if (tst06(s58) !== 58) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 698, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 698, + 2 + ], + Error: new Error() + }; } if (tst06(t58) !== 58) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 699, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 699, + 2 + ], + Error: new Error() + }; } if (tst06(s59) !== 59) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 700, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 700, + 2 + ], + Error: new Error() + }; } if (tst06(t59) !== 59) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 701, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 701, + 2 + ], + Error: new Error() + }; } if (tst06(s60) !== 60) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 702, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 702, + 2 + ], + Error: new Error() + }; } if (tst06(t60) !== 60) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 703, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 703, + 2 + ], + Error: new Error() + }; } if (tst06(s61) !== 61) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 704, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 704, + 2 + ], + Error: new Error() + }; } if (tst06(t61) !== 61) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 705, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 705, + 2 + ], + Error: new Error() + }; } if (tst06(s62) !== 62) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 706, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 706, + 2 + ], + Error: new Error() + }; } if (tst06(t62) !== 62) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 707, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 707, + 2 + ], + Error: new Error() + }; } if (tst06(s63) !== 63) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 708, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 708, + 2 + ], + Error: new Error() + }; } if (tst06(t63) !== 63) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 709, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 709, + 2 + ], + Error: new Error() + }; } if (tst06(s64) !== 64) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 710, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 710, + 2 + ], + Error: new Error() + }; } if (tst06(t64) !== 64) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 711, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 711, + 2 + ], + Error: new Error() + }; } if (tst06(s65) !== 65) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 712, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 712, + 2 + ], + Error: new Error() + }; } if (tst06(t65) !== 65) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 713, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 713, + 2 + ], + Error: new Error() + }; } if (tst06(s66) !== 66) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 714, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 714, + 2 + ], + Error: new Error() + }; } if (tst06(t66) !== 66) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 715, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 715, + 2 + ], + Error: new Error() + }; } if (tst06(s67) !== 67) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 716, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 716, + 2 + ], + Error: new Error() + }; } if (tst06(t67) !== 67) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 717, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 717, + 2 + ], + Error: new Error() + }; } if (tst06(s68) !== 68) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 718, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 718, + 2 + ], + Error: new Error() + }; } if (tst06(t68) !== 68) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 719, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 719, + 2 + ], + Error: new Error() + }; } if (tst06(s69) !== 69) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 720, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 720, + 2 + ], + Error: new Error() + }; } if (tst06(t69) !== 69) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 721, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 721, + 2 + ], + Error: new Error() + }; } if (tst06(s70) !== 70) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 722, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 722, + 2 + ], + Error: new Error() + }; } if (tst06(t70) !== 70) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 723, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 723, + 2 + ], + Error: new Error() + }; } if (tst06(s71) !== 71) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 724, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 724, + 2 + ], + Error: new Error() + }; } if (tst06(t71) !== 71) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 725, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 725, + 2 + ], + Error: new Error() + }; } if (tst06(s72) !== 72) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 726, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 726, + 2 + ], + Error: new Error() + }; } if (tst06(t72) !== 72) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 727, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 727, + 2 + ], + Error: new Error() + }; } if (tst06(s73) !== 73) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 728, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 728, + 2 + ], + Error: new Error() + }; } if (tst06(t73) !== 73) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 729, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 729, + 2 + ], + Error: new Error() + }; } if (tst06(s74) !== 74) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 730, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 730, + 2 + ], + Error: new Error() + }; } if (tst06(t74) !== 74) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 731, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 731, + 2 + ], + Error: new Error() + }; } if (tst06(s75) !== 75) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 732, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 732, + 2 + ], + Error: new Error() + }; } if (tst06(t75) !== 75) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 733, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 733, + 2 + ], + Error: new Error() + }; } if (tst06(s76) !== 76) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 734, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 734, + 2 + ], + Error: new Error() + }; } if (tst06(t76) !== 76) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 735, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 735, + 2 + ], + Error: new Error() + }; } if (tst06(s77) !== 77) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 736, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 736, + 2 + ], + Error: new Error() + }; } if (tst06(t77) !== 77) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 737, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 737, + 2 + ], + Error: new Error() + }; } if (tst06(s78) !== 78) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 738, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 738, + 2 + ], + Error: new Error() + }; } if (tst06(t78) !== 78) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 739, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 739, + 2 + ], + Error: new Error() + }; } if (tst06(s79) !== 79) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 740, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 740, + 2 + ], + Error: new Error() + }; } if (tst06(t79) !== 79) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 741, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 741, + 2 + ], + Error: new Error() + }; } if (tst06(s80) !== 80) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 742, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 742, + 2 + ], + Error: new Error() + }; } if (tst06(t80) !== 80) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 743, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 743, + 2 + ], + Error: new Error() + }; } if (tst06(s81) !== 81) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 744, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 744, + 2 + ], + Error: new Error() + }; } if (tst06(t81) !== 81) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 745, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 745, + 2 + ], + Error: new Error() + }; } if (tst06(s82) !== 82) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 746, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 746, + 2 + ], + Error: new Error() + }; } if (tst06(t82) !== 82) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 747, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 747, + 2 + ], + Error: new Error() + }; } if (tst06(s83) !== 83) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 748, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 748, + 2 + ], + Error: new Error() + }; } if (tst06(t83) !== 83) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 749, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 749, + 2 + ], + Error: new Error() + }; } if (tst06(s84) !== 84) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 750, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 750, + 2 + ], + Error: new Error() + }; } if (tst06(t84) !== 84) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 751, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 751, + 2 + ], + Error: new Error() + }; } if (tst06(s85) !== 85) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 752, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 752, + 2 + ], + Error: new Error() + }; } if (tst06(t85) !== 85) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 753, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 753, + 2 + ], + Error: new Error() + }; } if (tst06(s86) !== 86) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 754, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 754, + 2 + ], + Error: new Error() + }; } if (tst06(t86) !== 86) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 755, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 755, + 2 + ], + Error: new Error() + }; } if (tst06(s87) !== 87) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 756, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 756, + 2 + ], + Error: new Error() + }; } if (tst06(t87) !== 87) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 757, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 757, + 2 + ], + Error: new Error() + }; } if (tst06(s88) !== 88) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 758, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 758, + 2 + ], + Error: new Error() + }; } if (tst06(t88) !== 88) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 759, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 759, + 2 + ], + Error: new Error() + }; } if (tst06(s89) !== 89) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 760, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 760, + 2 + ], + Error: new Error() + }; } if (tst06(t89) !== 89) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 761, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 761, + 2 + ], + Error: new Error() + }; } if (tst06(s90) !== 90) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 762, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 762, + 2 + ], + Error: new Error() + }; } if (tst06(t90) !== 90) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 763, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 763, + 2 + ], + Error: new Error() + }; } if (tst06(s91) !== 91) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 764, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 764, + 2 + ], + Error: new Error() + }; } if (tst06(t91) !== 91) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 765, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 765, + 2 + ], + Error: new Error() + }; } if (tst06("") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 766, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 766, + 2 + ], + Error: new Error() + }; } exports.tst01 = tst01; diff --git a/jscomp/test/test_array_primitive.js b/jscomp/test/test_array_primitive.js index 3ac46e92e8..a840816333 100644 --- a/jscomp/test/test_array_primitive.js +++ b/jscomp/test/test_array_primitive.js @@ -13,24 +13,22 @@ function caml_array_sub(x, offset, len) { function caml_array_set(xs, index, newval) { if (index < 0 || index >= xs.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } Caml_array.set(xs, index, newval); } function caml_array_get(xs, index) { if (index < 0 || index >= xs.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return Caml_array.get(xs, index); } diff --git a/jscomp/test/test_bool_equal.js b/jscomp/test/test_bool_equal.js index d4a80430d8..549f7c36a7 100644 --- a/jscomp/test/test_bool_equal.js +++ b/jscomp/test/test_bool_equal.js @@ -18,52 +18,48 @@ function bool_equal(x, y) { function assertions() { if (!bool_equal(true, true)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 16, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 16, + 2 + ], + Error: new Error() + }; } if (!bool_equal(false, false)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 17, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 17, + 2 + ], + Error: new Error() + }; } if (bool_equal(true, false)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 18, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 18, + 2 + ], + Error: new Error() + }; } if (bool_equal(false, true)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 19, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 19, + 2 + ], + Error: new Error() + }; } } diff --git a/jscomp/test/test_closure.js b/jscomp/test/test_closure.js index 50cf48ad0a..2ab72395e4 100644 --- a/jscomp/test/test_closure.js +++ b/jscomp/test/test_closure.js @@ -23,16 +23,15 @@ let u = f(); $$Array.iter(x => x(), u); if (v.contents !== 45) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_closure.res", - 52, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_closure.res", + 52, + 2 + ], + Error: new Error() + }; } exports.v = v; diff --git a/jscomp/test/test_exception.js b/jscomp/test/test_exception.js index d8fd225654..c987a027fc 100644 --- a/jscomp/test/test_exception.js +++ b/jscomp/test/test_exception.js @@ -7,46 +7,41 @@ let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); let Local = /* @__PURE__ */Caml_exceptions.create("Test_exception.Local"); function f() { - throw new Error(Local, { - cause: { - RE_EXN_ID: Local, - _1: 3 - } - }); + throw { + RE_EXN_ID: Local, + _1: 3, + Error: new Error() + }; } function g() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function h() { - throw new Error(Test_common.U, { - cause: { - RE_EXN_ID: Test_common.U, - _1: 3 - } - }); + throw { + RE_EXN_ID: Test_common.U, + _1: 3, + Error: new Error() + }; } function x() { - throw new Error(Test_common.H, { - cause: { - RE_EXN_ID: Test_common.H - } - }); + throw { + RE_EXN_ID: Test_common.H, + Error: new Error() + }; } function xx() { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "x" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "x", + Error: new Error() + }; } let Nullary = /* @__PURE__ */Caml_exceptions.create("Test_exception.Nullary"); diff --git a/jscomp/test/test_exception_escape.js b/jscomp/test/test_exception_escape.js index 418fec2b66..b1fee39246 100644 --- a/jscomp/test/test_exception_escape.js +++ b/jscomp/test/test_exception_escape.js @@ -8,12 +8,11 @@ let A = /* @__PURE__ */Caml_exceptions.create("Test_exception_escape.N.A"); let f; try { - throw new Error(A, { - cause: { - RE_EXN_ID: A, - _1: 3 - } - }); + throw { + RE_EXN_ID: A, + _1: 3, + Error: new Error() + }; } catch (exn) { f = 3; } diff --git a/jscomp/test/test_for_map.js b/jscomp/test/test_for_map.js index d5400a46d9..58761a235a 100644 --- a/jscomp/test/test_for_map.js +++ b/jscomp/test/test_for_map.js @@ -43,12 +43,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -60,12 +59,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -78,12 +76,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -95,12 +92,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty(param) { @@ -161,11 +157,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -180,11 +175,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -258,11 +252,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -366,11 +359,10 @@ function min_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -406,11 +398,10 @@ function max_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -444,12 +435,11 @@ function max_binding_opt(_param) { function remove_min_binding(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -753,16 +743,15 @@ function merge$1(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); diff --git a/jscomp/test/test_incomplete.js b/jscomp/test/test_incomplete.js index bfcf01440e..22740d944e 100644 --- a/jscomp/test/test_incomplete.js +++ b/jscomp/test/test_incomplete.js @@ -6,16 +6,15 @@ function f(x) { if (!(x > 3 || x < 1)) { return /* 'a' */97; } - throw new Error("Match_failure", { - cause: { - RE_EXN_ID: "Match_failure", - _1: [ - "test_incomplete.res", - 3, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Match_failure", + _1: [ + "test_incomplete.res", + 3, + 2 + ], + Error: new Error() + }; } function f2(x) { diff --git a/jscomp/test/test_int_map_find.js b/jscomp/test/test_int_map_find.js index 8accca8abe..98227ccb29 100644 --- a/jscomp/test/test_int_map_find.js +++ b/jscomp/test/test_int_map_find.js @@ -32,12 +32,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -49,12 +48,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -67,12 +65,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -84,12 +81,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, param) { diff --git a/jscomp/test/test_list.js b/jscomp/test/test_list.js index c40fc0b557..fb1b9ac5d4 100644 --- a/jscomp/test/test_list.js +++ b/jscomp/test/test_list.js @@ -26,34 +26,31 @@ function hd(x) { if (x) { return x.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "hd", + Error: new Error() + }; } function tl(x) { if (x) { return x.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "tl", + Error: new Error() + }; } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -68,12 +65,11 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "nth", + Error: new Error() + }; }; } @@ -207,22 +203,20 @@ function map2(f, l1, l2) { tl: map2(f, l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } function rev_map2(f, l1, l2) { @@ -243,20 +237,18 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } return accu; }; @@ -273,22 +265,20 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; }; } @@ -304,20 +294,18 @@ function fold_left2(f, _accu, _l1, _l2) { _accu = f(accu, l1.hd, l2.hd); continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } return accu; }; @@ -328,20 +316,18 @@ function fold_right2(f, l1, l2, accu) { if (l2) { return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } return accu; } @@ -387,22 +373,20 @@ function for_all2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; }; } @@ -419,22 +403,20 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; }; } @@ -477,11 +459,10 @@ function assoc(x, _x_) { _x_ = x_.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -496,11 +477,10 @@ function assq(x, _x_) { _x_ = x_.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -575,11 +555,10 @@ function find(p, _x) { _x = x.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -674,22 +653,20 @@ function combine(l1, l2) { tl: combine(l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } function merge(cmp, l1, l2) { @@ -726,16 +703,15 @@ function chop(_k, _l) { _k = k - 1 | 0; continue; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_list.res", - 343, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_list.res", + 343, + 11 + ], + Error: new Error() + }; }; } diff --git a/jscomp/test/test_match_exception.js b/jscomp/test/test_match_exception.js index 6fe415efa7..ee79886634 100644 --- a/jscomp/test/test_match_exception.js +++ b/jscomp/test/test_match_exception.js @@ -11,9 +11,7 @@ function f(g, x) { if (exn.RE_EXN_ID === "Not_found") { return 3; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/jscomp/test/test_per.js b/jscomp/test/test_per.js index eea5830322..2932670776 100644 --- a/jscomp/test/test_per.js +++ b/jscomp/test/test_per.js @@ -7,21 +7,19 @@ let Caml_int64 = require("../../lib/js/caml_int64.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); function failwith(s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } - }); + throw { + RE_EXN_ID: "Failure", + _1: s, + Error: new Error() + }; } function invalid_arg(s) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } let Exit = /* @__PURE__ */Caml_exceptions.create("Test_per.Exit"); @@ -97,12 +95,11 @@ function $caret(s1, s2) { function char_of_int(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "char_of_int" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "char_of_int", + Error: new Error() + }; } return n; } diff --git a/jscomp/test/test_seq.js b/jscomp/test/test_seq.js index 10c3093667..f3358b1402 100644 --- a/jscomp/test/test_seq.js +++ b/jscomp/test/test_seq.js @@ -23,24 +23,22 @@ function assoc3(x, _l) { _l = l.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } function help_action() { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Unknown", - _0: "-help" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: "-help" + }, + Error: new Error() + }; } function v(speclist) { @@ -72,9 +70,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let add2; @@ -96,9 +92,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } return Pervasives.$at(speclist, Pervasives.$at(add1, add2)); diff --git a/jscomp/test/test_set.js b/jscomp/test/test_set.js index ff3dca7cfa..aea136d5da 100644 --- a/jscomp/test/test_set.js +++ b/jscomp/test/test_set.js @@ -31,12 +31,11 @@ function Make(Ord) { hr = typeof r !== "object" ? 0 : r._3; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l._2; let lv = l._1; @@ -47,12 +46,11 @@ function Make(Ord) { if (typeof lr === "object") { return create(create(ll, lv, lr._0), lr._1, create(lr._2, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -64,12 +62,11 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r._2; let rv = r._1; @@ -80,12 +77,11 @@ function Make(Ord) { if (typeof rl === "object") { return create(create(l, v, rl._0), rl._1, create(rl._2, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, x_) => { if (typeof x_ !== "object") { @@ -151,11 +147,10 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -169,11 +164,10 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = x._2; if (typeof r !== "object") { @@ -185,12 +179,11 @@ function Make(Ord) { }; let remove_min_elt = x => { if (typeof x !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = x._0; if (typeof l !== "object") { @@ -564,11 +557,10 @@ function Make(Ord) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = x_._1; let c = Ord.compare(x, v); @@ -670,16 +662,15 @@ function Make(Ord) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_set.res", - 497, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_set.res", + 497, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l), l)[0]; }; diff --git a/jscomp/test/test_static_catch_ident.js b/jscomp/test/test_static_catch_ident.js index 0f07ea108a..71f35bcd64 100644 --- a/jscomp/test/test_static_catch_ident.js +++ b/jscomp/test/test_static_catch_ident.js @@ -10,9 +10,7 @@ function scanf_bad_input(ib, x) { if (x.RE_EXN_ID === Scan_failure || x.RE_EXN_ID === "Failure") { s = x._1; } else { - throw new Error(x.RE_EXN_ID, { - cause: x - }); + throw x; } for (let i = 0; i <= 100; ++i) { console.log(s); diff --git a/jscomp/test/test_string.js b/jscomp/test/test_string.js index 6cda6ae83e..22ba5db87b 100644 --- a/jscomp/test/test_string.js +++ b/jscomp/test/test_string.js @@ -11,16 +11,15 @@ function f(x) { case "bbbb" : return 1; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_string.res", - 5, - 17 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_string.res", + 5, + 17 + ], + Error: new Error() + }; } } diff --git a/jscomp/test/test_string_case.js b/jscomp/test/test_string_case.js index 867814c4a6..dcd3cb6352 100644 --- a/jscomp/test/test_string_case.js +++ b/jscomp/test/test_string_case.js @@ -9,16 +9,15 @@ function f(x) { case "bcde" : return 1; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_string_case.res", - 5, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_string_case.res", + 5, + 9 + ], + Error: new Error() + }; } } diff --git a/jscomp/test/test_string_const.js b/jscomp/test/test_string_const.js index cadb0599f9..67c811f372 100644 --- a/jscomp/test/test_string_const.js +++ b/jscomp/test/test_string_const.js @@ -16,9 +16,7 @@ try { console.log(e._1); hh = /* 'a' */97; } else { - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } } diff --git a/jscomp/test/test_string_map.js b/jscomp/test/test_string_map.js index 21d8f1df73..fa07819203 100644 --- a/jscomp/test/test_string_map.js +++ b/jscomp/test/test_string_map.js @@ -31,12 +31,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -48,12 +47,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -66,12 +64,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -83,12 +80,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function add(x, data, param) { @@ -141,11 +137,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml.string_compare(x, param.v); if (c === 0) { diff --git a/jscomp/test/test_trywith.js b/jscomp/test/test_trywith.js index f327c553a7..bd5cd7321f 100644 --- a/jscomp/test/test_trywith.js +++ b/jscomp/test/test_trywith.js @@ -18,9 +18,7 @@ function ff(g, x) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID !== "Not_found") { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -29,9 +27,7 @@ function ff(g, x) { } catch (raw_exn$1) { let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); if (exn$1.RE_EXN_ID !== Out_of_memory) { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } @@ -40,9 +36,7 @@ function ff(g, x) { } catch (raw_exn$2) { let exn$2 = Caml_js_exceptions.internalToOCamlException(raw_exn$2); if (exn$2.RE_EXN_ID !== Sys_error) { - throw new Error(exn$2.RE_EXN_ID, { - cause: exn$2 - }); + throw exn$2; } } @@ -51,9 +45,7 @@ function ff(g, x) { } catch (raw_exn$3) { let exn$3 = Caml_js_exceptions.internalToOCamlException(raw_exn$3); if (exn$3.RE_EXN_ID !== "Invalid_argument") { - throw new Error(exn$3.RE_EXN_ID, { - cause: exn$3 - }); + throw exn$3; } } @@ -62,9 +54,7 @@ function ff(g, x) { } catch (raw_exn$4) { let exn$4 = Caml_js_exceptions.internalToOCamlException(raw_exn$4); if (exn$4.RE_EXN_ID !== "End_of_file") { - throw new Error(exn$4.RE_EXN_ID, { - cause: exn$4 - }); + throw exn$4; } } @@ -73,9 +63,7 @@ function ff(g, x) { } catch (raw_exn$5) { let exn$5 = Caml_js_exceptions.internalToOCamlException(raw_exn$5); if (exn$5.RE_EXN_ID !== "Match_failure") { - throw new Error(exn$5.RE_EXN_ID, { - cause: exn$5 - }); + throw exn$5; } } @@ -84,9 +72,7 @@ function ff(g, x) { } catch (raw_exn$6) { let exn$6 = Caml_js_exceptions.internalToOCamlException(raw_exn$6); if (exn$6.RE_EXN_ID !== Stack_overflow) { - throw new Error(exn$6.RE_EXN_ID, { - cause: exn$6 - }); + throw exn$6; } } @@ -95,9 +81,7 @@ function ff(g, x) { } catch (raw_exn$7) { let exn$7 = Caml_js_exceptions.internalToOCamlException(raw_exn$7); if (exn$7.RE_EXN_ID !== Sys_blocked_io) { - throw new Error(exn$7.RE_EXN_ID, { - cause: exn$7 - }); + throw exn$7; } } @@ -106,9 +90,7 @@ function ff(g, x) { } catch (raw_exn$8) { let exn$8 = Caml_js_exceptions.internalToOCamlException(raw_exn$8); if (exn$8.RE_EXN_ID !== "Assert_failure") { - throw new Error(exn$8.RE_EXN_ID, { - cause: exn$8 - }); + throw exn$8; } } @@ -119,18 +101,15 @@ function ff(g, x) { if (exn$9.RE_EXN_ID === "Undefined_recursive_module") { return; } - throw new Error(exn$9.RE_EXN_ID, { - cause: exn$9 - }); + throw exn$9; } } function u() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function f(x) { @@ -140,16 +119,15 @@ function f(x) { if (x.TAG === "D") { return 1; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_trywith.res", - 59, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_trywith.res", + 59, + 9 + ], + Error: new Error() + }; } let u1 = "bad character decimal encoding \\"; diff --git a/jscomp/test/test_while_closure.js b/jscomp/test/test_while_closure.js index 7235c903b0..c225a30bbb 100644 --- a/jscomp/test/test_while_closure.js +++ b/jscomp/test/test_while_closure.js @@ -28,16 +28,15 @@ $$Array.iter(x => x(), arr); console.log(String(v.contents)); if (v.contents !== 45) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_while_closure.res", - 55, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "test_while_closure.res", + 55, + 2 + ], + Error: new Error() + }; } let count = 10; diff --git a/jscomp/test/ticker.js b/jscomp/test/ticker.js index 8f8c2e3a23..35dd8d70b9 100644 --- a/jscomp/test/ticker.js +++ b/jscomp/test/ticker.js @@ -32,9 +32,7 @@ function split(delim, s) { tl: l }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } let l_0 = $$String.sub(s, i$p + 1 | 0, (x - i$p | 0) - 1 | 0); let l$1 = { @@ -132,12 +130,11 @@ function bal(l, x, d, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -149,12 +146,11 @@ function bal(l, x, d, r) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -167,12 +163,11 @@ function bal(l, x, d, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -184,12 +179,11 @@ function bal(l, x, d, r) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } function is_empty(param) { @@ -250,11 +244,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml_obj.compare(x, param.v); if (c === 0) { @@ -269,11 +262,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -347,11 +339,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -455,11 +446,10 @@ function min_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -495,11 +485,10 @@ function max_binding(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -533,12 +522,11 @@ function max_binding_opt(_param) { function remove_min_binding(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -842,16 +830,15 @@ function merge$1(f, s1, s2) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split$1(v2, s1); @@ -1159,38 +1146,34 @@ function compute_update_sequences(all_tickers) { let x = lhs.rank; if (typeof x !== "object") { if (x === "Uninitialized") { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "All nodes should be ranked" - } - }); - } - throw new Error("Failure", { - cause: { + throw { RE_EXN_ID: "Failure", - _1: "All nodes should be ranked" - } - }); + _1: "All nodes should be ranked", + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Failure", + _1: "All nodes should be ranked", + Error: new Error() + }; } else { let y = rhs.rank; if (typeof y === "object") { return Caml.int_compare(x._0, y._0); } if (y === "Uninitialized") { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "All nodes should be ranked" - } - }); - } - throw new Error("Failure", { - cause: { + throw { RE_EXN_ID: "Failure", - _1: "All nodes should be ranked" - } - }); + _1: "All nodes should be ranked", + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Failure", + _1: "All nodes should be ranked", + Error: new Error() + }; } }, l); return add(k, l$1, map); @@ -1206,12 +1189,11 @@ function process_quote(ticker_map, new_ticker, new_value) { ticker.value = new_value; return; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Only single Market ticker should be udpated upon a new quote" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Only single Market ticker should be udpated upon a new quote", + Error: new Error() + }; } let match$1 = match._0; let match$2 = match$1.lhs.value; @@ -1250,12 +1232,11 @@ function process_input_line(ticker_map, all_tickers, line) { let match$1 = match.tl; if (match$1) { if (match$1.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } let ticker_map$1 = ticker_map !== undefined ? Caml_option.valFromOption(ticker_map) : compute_update_sequences(all_tickers); let value = Caml_format.float_of_string(match$1.hd); @@ -1265,19 +1246,17 @@ function process_input_line(ticker_map, all_tickers, line) { Caml_option.some(ticker_map$1) ]; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); - } - throw new Error("Failure", { - cause: { + throw { RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + _1: "Invalid input line", + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; case "R" : let match$2 = tokens.tl; if (match$2) { @@ -1291,12 +1270,11 @@ function process_input_line(ticker_map, all_tickers, line) { let match$5 = match$4.tl; if (match$5) { if (match$5.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } return [ { @@ -1306,31 +1284,28 @@ function process_input_line(ticker_map, all_tickers, line) { ticker_map ]; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); - } - throw new Error("Failure", { - cause: { + throw { RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + _1: "Invalid input line", + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; case "-" : let match$6 = match$3.tl; if (match$6) { let match$7 = match$6.tl; if (match$7) { if (match$7.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } return [ { @@ -1340,27 +1315,24 @@ function process_input_line(ticker_map, all_tickers, line) { ticker_map ]; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); - } - throw new Error("Failure", { - cause: { + throw { RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + _1: "Invalid input line", + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; case "S" : if (match$3.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } return [ { @@ -1375,44 +1347,39 @@ function process_input_line(ticker_map, all_tickers, line) { ticker_map ]; default: - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } } else { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } } else { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } default: - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } } else { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Invalid input line", + Error: new Error() + }; } } diff --git a/jscomp/test/topsort_test.js b/jscomp/test/topsort_test.js index 286b48e805..9288827d8b 100644 --- a/jscomp/test/topsort_test.js +++ b/jscomp/test/topsort_test.js @@ -121,16 +121,15 @@ if (!Caml_obj.equal(dfs1({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 35, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 35, + 2 + ], + Error: new Error() + }; } console.log(""); @@ -160,16 +159,15 @@ if (!Caml_obj.equal(dfs1({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 38, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 38, + 2 + ], + Error: new Error() + }; } function dfs2(nodes, graph, visited) { @@ -222,16 +220,15 @@ if (!Caml_obj.equal(dfs2({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 57, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 57, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(dfs2({ @@ -259,16 +256,15 @@ if (!Caml_obj.equal(dfs2({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 58, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 58, + 2 + ], + Error: new Error() + }; } function dfs3(nodes, graph) { @@ -314,16 +310,15 @@ if (!Caml_obj.equal(dfs3({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 74, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 74, + 2 + ], + Error: new Error() + }; } if (!Caml_obj.equal(dfs3({ @@ -351,16 +346,15 @@ if (!Caml_obj.equal(dfs3({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 75, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 75, + 2 + ], + Error: new Error() + }; } let grwork = { @@ -439,16 +433,15 @@ if (!Caml_obj.equal(unsafe_topsort(grwork), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 112, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 112, + 9 + ], + Error: new Error() + }; } function height(param) { @@ -480,12 +473,11 @@ function bal(l, v, r) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -496,12 +488,11 @@ function bal(l, v, r) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -513,12 +504,11 @@ function bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -529,12 +519,11 @@ function bal(l, v, r) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } function add(x, param) { @@ -618,11 +607,10 @@ function min_elt(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -652,11 +640,10 @@ function max_elt(_param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -684,12 +671,11 @@ function max_elt_opt(_param) { function remove_min_elt(param) { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1103,11 +1089,10 @@ function find(x, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = Caml.string_compare(x, v); @@ -1123,11 +1108,10 @@ function find_first(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1189,11 +1173,10 @@ function find_last(f, _param) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1400,16 +1383,15 @@ function of_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l$1), l$1)[0]; } else { @@ -1472,15 +1454,14 @@ function pathsort(graph) { let stack = param[1]; let set = param[0]; if (mem(node, set)) { - throw new Error(Cycle, { - cause: { - RE_EXN_ID: Cycle, - _1: { - hd: node, - tl: stack - } - } - }); + throw { + RE_EXN_ID: Cycle, + _1: { + hd: node, + tl: stack + }, + Error: new Error() + }; } return [ add(node, set), @@ -1525,16 +1506,15 @@ if (!Caml_obj.equal(pathsort(grwork), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 144, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 144, + 9 + ], + Error: new Error() + }; } try { @@ -1545,16 +1525,15 @@ try { ], tl: grwork }); - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 148, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 148, + 2 + ], + Error: new Error() + }; } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); let exit = 0; @@ -1583,16 +1562,15 @@ try { exit = 1; } if (exit === 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 151, - 7 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 151, + 7 + ], + Error: new Error() + }; } } diff --git a/jscomp/test/uncurried_cast.js b/jscomp/test/uncurried_cast.js index 5ed7b4c208..92c87bf44b 100644 --- a/jscomp/test/uncurried_cast.js +++ b/jscomp/test/uncurried_cast.js @@ -5,9 +5,7 @@ let Belt_List = require("../../lib/js/belt_List.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); function raise(e) { - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } let map = Belt_List.map; @@ -24,11 +22,10 @@ let Uncurried = { let E = /* @__PURE__ */Caml_exceptions.create("Uncurried_cast.E"); function testRaise() { - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw { + RE_EXN_ID: E, + Error: new Error() + }; } let l = Belt_List.map({ @@ -66,11 +63,10 @@ let StandardNotation = { }; function testRaise$1() { - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw { + RE_EXN_ID: E, + Error: new Error() + }; } let l$1 = Belt_List.map({ diff --git a/jscomp/test/variant.js b/jscomp/test/variant.js index d184ff6061..0ee7797d01 100644 --- a/jscomp/test/variant.js +++ b/jscomp/test/variant.js @@ -91,9 +91,7 @@ function rollback_path(subst, p) { return "Pident | Papply"; } } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } } @@ -129,9 +127,7 @@ function fooExn(f) { let match = n._1; return match[0] + match[1] | 0; } - throw new Error(n.RE_EXN_ID, { - cause: n - }); + throw n; } } diff --git a/lib/es6/arg.js b/lib/es6/arg.js index 865ef5a72a..a02eb4814e 100644 --- a/lib/es6/arg.js +++ b/lib/es6/arg.js @@ -31,11 +31,10 @@ function assoc3(x, _l) { _l = l.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -57,15 +56,14 @@ function make_symlist(prefix, sep, suffix, l) { } function help_action() { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Unknown", - _0: "-help" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: "-help" + }, + Error: new Error() + }; } function add_help(speclist) { @@ -88,9 +86,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let add2; @@ -112,9 +108,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } return Pervasives.$at(speclist, Pervasives.$at(add1, add2)); @@ -159,9 +153,7 @@ function bool_of_string_opt(x) { if (exn.RE_EXN_ID === "Invalid_argument") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -173,9 +165,7 @@ function int_of_string_opt(x) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -187,9 +177,7 @@ function float_of_string_opt(x) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -261,24 +249,19 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } catch (raw_exn$1) { let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); if (exn$1.RE_EXN_ID === "Not_found") { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Unknown", - _0: s - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: s + }, + Error: new Error() + }; } - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let follow = match[1]; @@ -286,17 +269,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (follow === undefined) { return; } - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: follow, - _2: "no argument" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: follow, + _2: "no argument" + }, + Error: new Error() + }; }; let get_arg = () => { if (follow !== undefined) { @@ -305,15 +287,14 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if ((current.contents + 1 | 0) < argv.contents.length) { return Caml_array.get(argv.contents, current.contents + 1 | 0); } - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Missing", - _0: s - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Missing", + _0: s + }, + Error: new Error() + }; }; let consume_arg = () => { if (follow !== undefined) { @@ -333,17 +314,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (s$1 !== undefined) { f._0(s$1); } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg, - _2: "a boolean" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg, + _2: "a boolean" + }, + Error: new Error() + }; } return consume_arg(); case "Set" : @@ -367,17 +347,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x !== undefined) { f._0(x); } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$2, - _2: "an integer" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$2, + _2: "an integer" + }, + Error: new Error() + }; } return consume_arg(); case "Set_int" : @@ -386,17 +365,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x$1 !== undefined) { f._0.contents = x$1; } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$3, - _2: "an integer" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$3, + _2: "an integer" + }, + Error: new Error() + }; } return consume_arg(); case "Float" : @@ -405,17 +383,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x$2 !== undefined) { f._0(x$2); } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$4, - _2: "a float" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$4, + _2: "a float" + }, + Error: new Error() + }; } return consume_arg(); case "Set_float" : @@ -424,17 +401,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x$3 !== undefined) { f._0.contents = x$3; } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$5, - _2: "a float" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$5, + _2: "a float" + }, + Error: new Error() + }; } return consume_arg(); case "Tuple" : @@ -446,17 +422,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist f._1(arg$6); return consume_arg(); } - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$6, - _2: "one of: " + make_symlist("", " ", "", symb) - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$6, + _2: "one of: " + make_symlist("", " ", "", symb) + }, + Error: new Error() + }; case "Rest" : let f$1 = f._0; while (current.contents < (argv.contents.length - 1 | 0)) { @@ -466,12 +441,11 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist return; case "Expand" : if (!allow_expand) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Arg.Expand is is only allowed with Arg.parse_and_expand_argv_dynamic" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Arg.Expand is is only allowed with Arg.parse_and_expand_argv_dynamic", + Error: new Error() + }; } let arg$7 = get_arg(); let newarg = f._0(arg$7); @@ -498,24 +472,15 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } catch (raw_m) { let m = Caml_js_exceptions.internalToOCamlException(raw_m); if (m.RE_EXN_ID === Bad) { - throw new Error(convert_error({ + throw convert_error({ TAG: "Message", _0: m._1 - }).RE_EXN_ID, { - cause: convert_error({ - TAG: "Message", - _0: m._1 - }) }); } if (m.RE_EXN_ID === Stop) { - throw new Error(convert_error(m._1).RE_EXN_ID, { - cause: convert_error(m._1) - }); + throw convert_error(m._1); } - throw new Error(m.RE_EXN_ID, { - cause: m - }); + throw m; } current.contents = current.contents + 1 | 0; }; @@ -552,9 +517,7 @@ function parse(l, f, msg) { console.log(msg$1._1); return Pervasives.exit(0); } - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } @@ -571,9 +534,7 @@ function parse_dynamic(l, f, msg) { console.log(msg$1._1); return Pervasives.exit(0); } - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } @@ -599,9 +560,7 @@ function parse_expand(l, f, msg) { console.log(msg$1._1); return Pervasives.exit(0); } - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } @@ -636,18 +595,14 @@ function second_word(s) { if (exn$1.RE_EXN_ID === "Not_found") { return len; } - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } if (exit === 2) { return loop(n$1 + 1 | 0); } } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } return loop(n + 1 | 0); diff --git a/lib/es6/array.js b/lib/es6/array.js index e53c2c06d2..ff3b8d976d 100644 --- a/lib/es6/array.js +++ b/lib/es6/array.js @@ -14,12 +14,11 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.init", + Error: new Error() + }; } let res = Caml_array.make(l, f(0)); for (let i = 1; i < l; ++i) { @@ -58,24 +57,22 @@ function append(a1, a2) { function sub(a, ofs, len) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } return Caml_array.sub(a, ofs, len); } function fill(a, ofs, len, v) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill", + Error: new Error() + }; } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { a[i] = v; @@ -84,12 +81,11 @@ function fill(a, ofs, len, v) { function blit(a1, ofs1, a2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } Caml_array.blit(a1, ofs1, a2, ofs2, len); } @@ -102,12 +98,11 @@ function iter(f, a) { function iter2(f, a, b) { if (a.length !== b.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.iter2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length", + Error: new Error() + }; } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { f(a[i], b[i]); @@ -130,12 +125,11 @@ function map2(f, a, b) { let la = a.length; let lb = b.length; if (la !== lb) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.map2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length", + Error: new Error() + }; } if (la === 0) { return []; @@ -317,12 +311,11 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } - }); + throw { + RE_EXN_ID: Bottom, + _1: i, + Error: new Error() + }; }; let trickle = (l, i, e) => { try { @@ -342,9 +335,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return Caml_array.set(a, i$2._1, e); } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let bubble = (l, i) => { @@ -362,9 +353,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return i$2._1; } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let trickleup = (_i, e) => { @@ -372,16 +361,15 @@ function sort(cmp, a) { let i = _i; let father = (i - 1 | 0) / 3 | 0; if (i === father) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "array.res", - 321, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "array.res", + 321, + 4 + ], + Error: new Error() + }; } if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); diff --git a/lib/es6/arrayLabels.js b/lib/es6/arrayLabels.js index 4952c602c5..8832f68edb 100644 --- a/lib/es6/arrayLabels.js +++ b/lib/es6/arrayLabels.js @@ -14,12 +14,11 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.init", + Error: new Error() + }; } let res = Caml_array.make(l, f(0)); for (let i = 1; i < l; ++i) { @@ -58,24 +57,22 @@ function append(a1, a2) { function sub(a, ofs, len) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } return Caml_array.sub(a, ofs, len); } function fill(a, ofs, len, v) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill", + Error: new Error() + }; } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { a[i] = v; @@ -84,12 +81,11 @@ function fill(a, ofs, len, v) { function blit(a1, ofs1, a2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } Caml_array.blit(a1, ofs1, a2, ofs2, len); } @@ -102,12 +98,11 @@ function iter(f, a) { function iter2(f, a, b) { if (a.length !== b.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.iter2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length", + Error: new Error() + }; } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { f(a[i], b[i]); @@ -130,12 +125,11 @@ function map2(f, a, b) { let la = a.length; let lb = b.length; if (la !== lb) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.map2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length", + Error: new Error() + }; } if (la === 0) { return []; @@ -317,12 +311,11 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } - }); + throw { + RE_EXN_ID: Bottom, + _1: i, + Error: new Error() + }; }; let trickle = (l, i, e) => { try { @@ -342,9 +335,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return Caml_array.set(a, i$2._1, e); } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let bubble = (l, i) => { @@ -362,9 +353,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return i$2._1; } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let trickleup = (_i, e) => { @@ -372,16 +361,15 @@ function sort(cmp, a) { let i = _i; let father = (i - 1 | 0) / 3 | 0; if (i === father) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "arrayLabels.res", - 321, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "arrayLabels.res", + 321, + 4 + ], + Error: new Error() + }; } if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); diff --git a/lib/es6/belt_Array.js b/lib/es6/belt_Array.js index c3d940cbf5..52df9f4a28 100644 --- a/lib/es6/belt_Array.js +++ b/lib/es6/belt_Array.js @@ -12,16 +12,15 @@ function get(arr, i) { function getExn(arr, i) { if (!(i >= 0 && i < arr.length)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_Array.res", - 36, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 36, + 2 + ], + Error: new Error() + }; } return arr[i]; } @@ -37,16 +36,15 @@ function set(arr, i, v) { function setExn(arr, i, v) { if (!(i >= 0 && i < arr.length)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_Array.res", - 49, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 49, + 2 + ], + Error: new Error() + }; } arr[i] = v; } diff --git a/lib/es6/belt_List.js b/lib/es6/belt_List.js index a4c8e13787..219db44fc9 100644 --- a/lib/es6/belt_List.js +++ b/lib/es6/belt_List.js @@ -15,11 +15,10 @@ function headExn(x) { if (x) { return x.hd; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function tail(x) { @@ -33,11 +32,10 @@ function tailExn(x) { if (x) { return x.tl; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function add(xs, x) { @@ -71,11 +69,10 @@ function get(x, n) { function getExn(x, n) { if (n < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let _x = x; let _n = n; @@ -90,11 +87,10 @@ function getExn(x, n) { _x = x$1.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/belt_MutableQueue.js b/lib/es6/belt_MutableQueue.js index 40a4a0cc97..04f7171036 100644 --- a/lib/es6/belt_MutableQueue.js +++ b/lib/es6/belt_MutableQueue.js @@ -54,11 +54,10 @@ function peekExn(q) { if (v !== undefined) { return v.content; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function pop(q) { @@ -90,11 +89,10 @@ function popExn(q) { return x.content; } } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function popUndefined(q) { diff --git a/lib/es6/belt_Option.js b/lib/es6/belt_Option.js index 12cb715f94..318e5e749e 100644 --- a/lib/es6/belt_Option.js +++ b/lib/es6/belt_Option.js @@ -20,11 +20,10 @@ function getExn(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function mapWithDefault(opt, $$default, f) { diff --git a/lib/es6/belt_Result.js b/lib/es6/belt_Result.js index 90f1370d0e..54b73dcfa8 100644 --- a/lib/es6/belt_Result.js +++ b/lib/es6/belt_Result.js @@ -5,11 +5,10 @@ function getExn(x) { if (x.TAG === "Ok") { return x._0; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function mapWithDefault(opt, $$default, f) { diff --git a/lib/es6/belt_internalAVLset.js b/lib/es6/belt_internalAVLset.js index 3e680658a9..1306dda6c3 100644 --- a/lib/es6/belt_internalAVLset.js +++ b/lib/es6/belt_internalAVLset.js @@ -349,16 +349,15 @@ function checkInvariantInternal(_v) { r !== undefined ? r.h : 0 ) | 0; if (!(diff <= 2 && diff >= -2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_internalAVLset.res", - 310, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLset.res", + 310, + 4 + ], + Error: new Error() + }; } checkInvariantInternal(l); _v = r; @@ -700,11 +699,10 @@ function getExn(_n, x, cmp) { _n = c < 0 ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/belt_internalAVLtree.js b/lib/es6/belt_internalAVLtree.js index dcbd04e32e..37ee7a6a2f 100644 --- a/lib/es6/belt_internalAVLtree.js +++ b/lib/es6/belt_internalAVLtree.js @@ -546,16 +546,15 @@ function checkInvariantInternal(_v) { let r = v.r; let diff = treeHeight(l) - treeHeight(r) | 0; if (!(diff <= 2 && diff >= -2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_internalAVLtree.res", - 439, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLtree.res", + 439, + 4 + ], + Error: new Error() + }; } checkInvariantInternal(l); _v = r; @@ -849,11 +848,10 @@ function getExn(_n, x, cmp) { _n = c < 0 ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/belt_internalMapInt.js b/lib/es6/belt_internalMapInt.js index 7f54f84751..4c3042dabb 100644 --- a/lib/es6/belt_internalMapInt.js +++ b/lib/es6/belt_internalMapInt.js @@ -62,11 +62,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/belt_internalMapString.js b/lib/es6/belt_internalMapString.js index d048bcc96f..3b98f118ff 100644 --- a/lib/es6/belt_internalMapString.js +++ b/lib/es6/belt_internalMapString.js @@ -62,11 +62,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/belt_internalSetInt.js b/lib/es6/belt_internalSetInt.js index 25243c2d97..1e5a5bb2c2 100644 --- a/lib/es6/belt_internalSetInt.js +++ b/lib/es6/belt_internalSetInt.js @@ -141,11 +141,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/belt_internalSetString.js b/lib/es6/belt_internalSetString.js index cf752d348b..8de7f3eaff 100644 --- a/lib/es6/belt_internalSetString.js +++ b/lib/es6/belt_internalSetString.js @@ -141,11 +141,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/es6/buffer.js b/lib/es6/buffer.js index 13da86c768..09ba8d632d 100644 --- a/lib/es6/buffer.js +++ b/lib/es6/buffer.js @@ -26,36 +26,33 @@ function to_bytes(b) { function sub(b, ofs, len) { if (ofs < 0 || len < 0 || ofs > (b.position - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub", + Error: new Error() + }; } return Bytes.sub_string(b.buffer, ofs, len); } function blit(src, srcoff, dst, dstoff, len) { if (len < 0 || srcoff < 0 || srcoff > (src.position - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit", + Error: new Error() + }; } Bytes.blit(src.buffer, srcoff, dst, dstoff, len); } function nth(b, ofs) { if (ofs < 0 || ofs >= b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth", + Error: new Error() + }; } return b.buffer[ofs]; } @@ -98,16 +95,15 @@ function add_char(b, c) { function add_utf_8_uchar(b, u) { let u$1 = u; if (u$1 < 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 98, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 98, + 18 + ], + Error: new Error() + }; } if (u$1 <= 127) { return add_char(b, u$1); @@ -145,31 +141,29 @@ function add_utf_8_uchar(b, u) { b.position = pos$2 + 4 | 0; return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 127, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 127, + 9 + ], + Error: new Error() + }; } function add_utf_16be_uchar(b, u) { let u$1 = u; if (u$1 < 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 132, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 132, + 18 + ], + Error: new Error() + }; } if (u$1 <= 65535) { let pos = b.position; @@ -196,31 +190,29 @@ function add_utf_16be_uchar(b, u) { b.position = pos$1 + 4 | 0; return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 154, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 154, + 9 + ], + Error: new Error() + }; } function add_utf_16le_uchar(b, u) { let u$1 = u; if (u$1 < 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 159, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 159, + 18 + ], + Error: new Error() + }; } if (u$1 <= 65535) { let pos = b.position; @@ -247,26 +239,24 @@ function add_utf_16le_uchar(b, u) { b.position = pos$1 + 4 | 0; return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 181, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 181, + 9 + ], + Error: new Error() + }; } function add_substring(b, s, offset, len) { if (offset < 0 || len < 0 || offset > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.add_substring/add_subbytes" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.add_substring/add_subbytes", + Error: new Error() + }; } let new_position = b.position + len | 0; if (new_position > b.length) { @@ -305,16 +295,15 @@ function closing(param) { if (param === 123) { return /* '}' */125; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 216, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 216, + 9 + ], + Error: new Error() + }; } function advance_to_closing(opening, closing, k, s, start) { @@ -325,11 +314,10 @@ function advance_to_closing(opening, closing, k, s, start) { let i = _i; let k$1 = _k; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (Caml_string.get(s, i) === opening) { _i = i + 1 | 0; @@ -383,11 +371,10 @@ function advance_to_non_alpha(s, start) { function find_ident(s, start, lim) { if (start >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml_string.get(s, start); if (c !== 40 && c !== 123) { @@ -455,12 +442,11 @@ function add_substitute(b, f, s) { function truncate(b, len) { if (len < 0 || len > b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.truncate" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate", + Error: new Error() + }; } b.position = len; } diff --git a/lib/es6/bytes.js b/lib/es6/bytes.js index ef34d50b27..518ae3c793 100644 --- a/lib/es6/bytes.js +++ b/lib/es6/bytes.js @@ -110,12 +110,11 @@ function of_string(s) { function sub(s, ofs, len) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.sub / Bytes.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub", + Error: new Error() + }; } let r = Caml_bytes.create(len); unsafe_blit(s, ofs, r, 0, len); @@ -138,23 +137,21 @@ function $plus$plus(a, b) { if (match$2) { return c; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } return c; } @@ -180,36 +177,33 @@ function extend(s, left, right) { function fill(s, ofs, len, c) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } unsafe_fill(s, ofs, len, c); } function blit(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } unsafe_blit(s1, ofs1, s2, ofs2, len); } function blit_string(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } if (len <= 0) { return; @@ -245,12 +239,11 @@ function ensure_ge(x, y) { if (x >= y) { return x; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.concat" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat", + Error: new Error() + }; } function sum_lengths(_acc, seplen, _param) { @@ -489,11 +482,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -528,12 +520,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -541,12 +532,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -555,11 +545,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -575,12 +564,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -605,12 +593,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -618,12 +605,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -633,9 +619,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,12 +629,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -660,9 +643,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/bytesLabels.js b/lib/es6/bytesLabels.js index ef34d50b27..518ae3c793 100644 --- a/lib/es6/bytesLabels.js +++ b/lib/es6/bytesLabels.js @@ -110,12 +110,11 @@ function of_string(s) { function sub(s, ofs, len) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.sub / Bytes.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub", + Error: new Error() + }; } let r = Caml_bytes.create(len); unsafe_blit(s, ofs, r, 0, len); @@ -138,23 +137,21 @@ function $plus$plus(a, b) { if (match$2) { return c; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } return c; } @@ -180,36 +177,33 @@ function extend(s, left, right) { function fill(s, ofs, len, c) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } unsafe_fill(s, ofs, len, c); } function blit(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } unsafe_blit(s1, ofs1, s2, ofs2, len); } function blit_string(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } if (len <= 0) { return; @@ -245,12 +239,11 @@ function ensure_ge(x, y) { if (x >= y) { return x; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.concat" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat", + Error: new Error() + }; } function sum_lengths(_acc, seplen, _param) { @@ -489,11 +482,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -528,12 +520,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -541,12 +532,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -555,11 +545,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -575,12 +564,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -605,12 +593,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -618,12 +605,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -633,9 +619,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,12 +629,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -660,9 +643,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/caml_array.js b/lib/es6/caml_array.js index 692a92b75e..c9d8e3c8b0 100644 --- a/lib/es6/caml_array.js +++ b/lib/es6/caml_array.js @@ -57,24 +57,22 @@ function concat(l) { function set(xs, index, newval) { if (index < 0 || index >= xs.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } xs[index] = newval; } function get(xs, index) { if (index < 0 || index >= xs.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return xs[index]; } diff --git a/lib/es6/caml_bigint.js b/lib/es6/caml_bigint.js index bdac616c54..098bf20b67 100644 --- a/lib/es6/caml_bigint.js +++ b/lib/es6/caml_bigint.js @@ -3,22 +3,20 @@ function div(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x / y; } function mod_(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x % y; } diff --git a/lib/es6/caml_bytes.js b/lib/es6/caml_bytes.js index 72ae5a5032..86d784b8cf 100644 --- a/lib/es6/caml_bytes.js +++ b/lib/es6/caml_bytes.js @@ -3,36 +3,33 @@ function set(s, i, ch) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } s[i] = ch; } function get(s, i) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return s[i]; } function create(len) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.create" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.create", + Error: new Error() + }; } let result = new Array(len); for (let i = 0; i < len; ++i) { diff --git a/lib/es6/caml_format.js b/lib/es6/caml_format.js index e0441baf86..4a806955d6 100644 --- a/lib/es6/caml_format.js +++ b/lib/es6/caml_format.js @@ -129,12 +129,11 @@ function int_of_string(s) { let c = i < len ? s.codePointAt(i) : /* '\000' */0; let d = parse_digit(c); if (d < 0 || d >= base) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } let aux = (_acc, _k) => { while (true) { @@ -150,21 +149,19 @@ function int_of_string(s) { } let v = parse_digit(a); if (v < 0 || v >= base) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } let acc$1 = base * acc + v; if (acc$1 > threshold) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } _k = k + 1 | 0; _acc = acc$1; @@ -174,12 +171,11 @@ function int_of_string(s) { let res = match[1] * aux(d, i + 1 | 0); let or_res = res | 0; if (base === 10 && res !== or_res) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } return or_res; } @@ -218,12 +214,11 @@ function int64_of_string(s) { let c = i < len ? s.codePointAt(i) : /* '\000' */0; let d = Caml_int64.of_int32(parse_digit(c)); if (Caml.i64_lt(d, Caml_int64.zero) || Caml.i64_ge(d, base)) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int64_of_string", + Error: new Error() + }; } let aux = (_acc, _k) => { while (true) { @@ -239,12 +234,11 @@ function int64_of_string(s) { } let v = Caml_int64.of_int32(parse_digit(a)); if (Caml.i64_lt(v, Caml_int64.zero) || Caml.i64_ge(v, base) || Caml.i64_gt(acc, threshold)) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int64_of_string", + Error: new Error() + }; } let acc$1 = Caml_int64.add(Caml_int64.mul(base, acc), v); _k = k + 1 | 0; @@ -258,12 +252,11 @@ function int64_of_string(s) { 0, 10 ]) && Caml.i64_neq(res, or_res)) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int64_of_string", + Error: new Error() + }; } return or_res; } @@ -290,12 +283,11 @@ function lowercase(c) { function parse_format(fmt) { let len = fmt.length; if (len > 31) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "format_int: format too long" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "format_int: format too long", + Error: new Error() + }; } let f = { justify: "+", @@ -773,7 +765,7 @@ let float_of_string = (function(s,exn){ return Infinity; if (/^-inf(inity)?$/i.test(s)) return -Infinity; - throw new Error(exn.RE_EXN_ID, { cause: exn });; + throw exn; }); function float_of_string$1(s) { diff --git a/lib/es6/caml_int32.js b/lib/es6/caml_int32.js index b5cd97b472..adc5a19e40 100644 --- a/lib/es6/caml_int32.js +++ b/lib/es6/caml_int32.js @@ -3,22 +3,20 @@ function div(x, y) { if (y === 0) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x / y | 0; } function mod_(x, y) { if (y === 0) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x % y; } diff --git a/lib/es6/caml_int64.js b/lib/es6/caml_int64.js index 7e0be85c45..2ad58e6cf4 100644 --- a/lib/es6/caml_int64.js +++ b/lib/es6/caml_int64.js @@ -383,11 +383,10 @@ function div(_self, _other) { if (other[0] !== 0 || other[1] !== 0) { exit$1 = 2; } else { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } if (exit$1 === 2) { if (self_hi !== -2147483648) { diff --git a/lib/es6/caml_js_exceptions.js b/lib/es6/caml_js_exceptions.js index dccd3a3a10..8c89bc2438 100644 --- a/lib/es6/caml_js_exceptions.js +++ b/lib/es6/caml_js_exceptions.js @@ -6,8 +6,8 @@ import * as Caml_exceptions from "./caml_exceptions.js"; let $$Error = "JsError"; function internalToOCamlException(e) { - if (Caml_exceptions.is_extension(e.cause)) { - return e.cause; + if (Caml_exceptions.is_extension(e)) { + return e; } else { return { RE_EXN_ID: "JsError", diff --git a/lib/es6/caml_lexer.js b/lib/es6/caml_lexer.js index b50a5a45f6..a1ad028fd3 100644 --- a/lib/es6/caml_lexer.js +++ b/lib/es6/caml_lexer.js @@ -87,7 +87,7 @@ let caml_lex_engine_aux = (function (tbl, start_state, lexbuf, exn){ if (state < 0) { lexbuf.lex_curr_pos = lexbuf.lex_last_pos; if (lexbuf.lex_last_action == -1) - throw new Error(exn.RE_EXN_ID, { cause: exn }) + throw exn else return lexbuf.lex_last_action; } @@ -222,7 +222,7 @@ let caml_new_lex_engine_aux = (function (tbl, start_state, lexbuf, exn) { if (state < 0) { lexbuf.lex_curr_pos = lexbuf.lex_last_pos; if (lexbuf.lex_last_action == -1) - throw new Error(exn.RE_EXN_ID, { cause: exn }); + throw exn; else return lexbuf.lex_last_action; } diff --git a/lib/es6/caml_module.js b/lib/es6/caml_module.js index 51988ea254..09f354ec2e 100644 --- a/lib/es6/caml_module.js +++ b/lib/es6/caml_module.js @@ -4,12 +4,11 @@ import * as Caml_obj from "./caml_obj.js"; function init_mod(loc, shape) { let undef_module = param => { - throw new Error("Undefined_recursive_module", { - cause: { - RE_EXN_ID: "Undefined_recursive_module", - _1: loc - } - }); + throw { + RE_EXN_ID: "Undefined_recursive_module", + _1: loc, + Error: new Error() + }; }; let loop = (shape, struct_, idx) => { if (typeof shape !== "object") { @@ -74,16 +73,15 @@ function update_mod(shape, o, n) { } }; if (typeof shape !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "caml_module.res", - 109, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ], + Error: new Error() + }; } if (shape.TAG === "Module") { let comps = shape._0; @@ -94,16 +92,15 @@ function update_mod(shape, o, n) { } return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "caml_module.res", - 109, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ], + Error: new Error() + }; } export { diff --git a/lib/es6/caml_obj.js b/lib/es6/caml_obj.js index 9d025bf517..cf871f8a91 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -55,12 +55,11 @@ function compare(a, b) { break; case "function" : if (b_type === "function") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "compare: functional value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "compare: functional value", + Error: new Error() + }; } break; case "number" : @@ -136,12 +135,11 @@ function compare(a, b) { return Caml.int_compare(a[1], b[1]); } if (tag_a === 251) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; } if (tag_a !== tag_b) { if (tag_a < tag_b) { @@ -262,12 +260,11 @@ function equal(a, b) { } let b_type = typeof b; if (a_type === "function" || b_type === "function") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: functional value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: functional value", + Error: new Error() + }; } if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { return false; @@ -278,12 +275,11 @@ function equal(a, b) { return a[1] === b[1]; } if (tag_a === 251) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; } if (tag_a !== tag_b) { return false; diff --git a/lib/es6/caml_string.js b/lib/es6/caml_string.js index 8fe93ba893..741ccb6ddf 100644 --- a/lib/es6/caml_string.js +++ b/lib/es6/caml_string.js @@ -3,12 +3,11 @@ function get(s, i) { if (i >= s.length || i < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return s.codePointAt(i); } diff --git a/lib/es6/caml_sys.js b/lib/es6/caml_sys.js index c1b42a6668..864a14fabf 100644 --- a/lib/es6/caml_sys.js +++ b/lib/es6/caml_sys.js @@ -3,21 +3,19 @@ function sys_getenv(s) { if (typeof process === "undefined" || process.env === undefined) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let x = process.env[s]; if (x !== undefined) { return x; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let os_type = (function(_){ @@ -73,21 +71,19 @@ function sys_exit(exit_code) { } function sys_is_directory(_s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_is_directory not implemented" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "sys_is_directory not implemented", + Error: new Error() + }; } function sys_file_exists(_s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_file_exists not implemented" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "sys_file_exists not implemented", + Error: new Error() + }; } export { diff --git a/lib/es6/camlinternalLazy.js b/lib/es6/camlinternalLazy.js index 59fa0b914d..c6dbdc0c20 100644 --- a/lib/es6/camlinternalLazy.js +++ b/lib/es6/camlinternalLazy.js @@ -16,11 +16,10 @@ function forward_with_closure(blk, closure) { } function raise_undefined() { - throw new Error(Undefined, { - cause: { - RE_EXN_ID: Undefined - } - }); + throw { + RE_EXN_ID: Undefined, + Error: new Error() + }; } function force(lzv) { @@ -33,13 +32,9 @@ function force(lzv) { return forward_with_closure(lzv, closure); } catch (e) { lzv.VAL = () => { - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; }; - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } } } diff --git a/lib/es6/char.js b/lib/es6/char.js index f9da73cd4f..79cec11931 100644 --- a/lib/es6/char.js +++ b/lib/es6/char.js @@ -4,12 +4,11 @@ import * as Bytes from "./bytes.js"; function chr(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr", + Error: new Error() + }; } return n; } diff --git a/lib/es6/digest.js b/lib/es6/digest.js index 1eded13e8a..3226f12277 100644 --- a/lib/es6/digest.js +++ b/lib/es6/digest.js @@ -17,12 +17,11 @@ function bytes(b) { function substring(str, ofs, len) { if (ofs < 0 || len < 0 || ofs > (str.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.substring" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring", + Error: new Error() + }; } return Caml_md5.md5_string(str, ofs, len); } @@ -39,12 +38,11 @@ function char_hex(n) { function to_hex(d) { if (d.length !== 16) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.to_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.to_hex", + Error: new Error() + }; } let result = Caml_bytes.create(32); for (let i = 0; i <= 15; ++i) { @@ -57,43 +55,39 @@ function to_hex(d) { function from_hex(s) { if (s.length !== 32) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } let digit = c => { if (c >= 65) { if (c >= 97) { if (c >= 103) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } return (c - /* 'a' */97 | 0) + 10 | 0; } if (c >= 71) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } return (c - /* 'A' */65 | 0) + 10 | 0; } if (c > 57 || c < 48) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } return c - /* '0' */48 | 0; }; diff --git a/lib/es6/filename.js b/lib/es6/filename.js index 38a8258878..c186255abe 100644 --- a/lib/es6/filename.js +++ b/lib/es6/filename.js @@ -123,9 +123,7 @@ try { if (exn.RE_EXN_ID === "Not_found") { temp_dir_name = "/tmp"; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -205,9 +203,7 @@ try { if (exn$1.RE_EXN_ID === "Not_found") { temp_dir_name$1 = "."; } else { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } @@ -382,12 +378,11 @@ function concat(dirname, filename) { function chop_suffix(name, suff) { let n = name.length - suff.length | 0; if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_suffix" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix", + Error: new Error() + }; } return $$String.sub(name, 0, n); } @@ -430,12 +425,11 @@ function extension(name) { function chop_extension(name) { let l = extension_len(name); if (l === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_extension" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension", + Error: new Error() + }; } return $$String.sub(name, 0, name.length - l | 0); } diff --git a/lib/es6/genlex.js b/lib/es6/genlex.js index d3d551a979..72c88899ec 100644 --- a/lib/es6/genlex.js +++ b/lib/es6/genlex.js @@ -58,9 +58,7 @@ function make_lexer(keywords) { _0: id }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let keyword_or_error = c => { @@ -70,16 +68,13 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "Illegal character " + s - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "Illegal character " + s, + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let next_token = strm__ => { @@ -118,26 +113,22 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } let match = Stream.peek(strm__); if (match !== undefined) { if (match !== 39) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); return { @@ -145,12 +136,11 @@ function make_lexer(keywords) { _0: c$1 }; } - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; case 40 : Stream.junk(strm__); let match$1 = Stream.peek(strm__); @@ -473,16 +463,13 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } store(c$1); continue; @@ -490,11 +477,10 @@ function make_lexer(keywords) { Stream.junk(strm__); return get_string(); } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; }; }; let char = strm__ => { @@ -510,23 +496,19 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; } }; let escape = strm__ => { @@ -553,50 +535,45 @@ function make_lexer(keywords) { let c2 = Stream.peek(strm__); if (c2 !== undefined) { if (c2 > 57 || c2 < 48) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); let c3 = Stream.peek(strm__); if (c3 !== undefined) { if (c3 > 57 || c3 < 48) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); return Char.chr((Math.imul(c1 - 48 | 0, 100) + Math.imul(c2 - 48 | 0, 10) | 0) + (c3 - 48 | 0) | 0); } - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); - } - throw new Error(Stream.$$Error, { - cause: { + throw { RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + _1: "", + Error: new Error() + }; + } + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); return c1; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; } }; let comment = strm__ => { @@ -617,11 +594,10 @@ function make_lexer(keywords) { return comment(strm__); } } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; case 42 : Stream.junk(strm__); while (true) { @@ -638,22 +614,20 @@ function make_lexer(keywords) { Stream.junk(strm__); return; } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; }; default: Stream.junk(strm__); continue; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; } }; }; diff --git a/lib/es6/hashtbl.js b/lib/es6/hashtbl.js index 4337892b11..f7b49ab4a7 100644 --- a/lib/es6/hashtbl.js +++ b/lib/es6/hashtbl.js @@ -109,16 +109,15 @@ function copy_bucketlist(param) { next: next }; if (typeof prec !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "hashtbl.res", - 110, - 19 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "hashtbl.res", + 110, + 19 + ], + Error: new Error() + }; } prec.next = r; _param = next; @@ -252,11 +251,10 @@ function remove(h, key) { function find(h, key) { let match = Caml_array.get(h.data, key_index(h, key)); if (typeof match !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k1 = match.key; let d1 = match.data; @@ -265,11 +263,10 @@ function find(h, key) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k2 = next1.key; let d2 = next1.data; @@ -278,11 +275,10 @@ function find(h, key) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k3 = next2.key; let d3 = next2.data; @@ -294,11 +290,10 @@ function find(h, key) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k = param.key; let data = param.data; @@ -468,14 +463,10 @@ function iter(f, h) { } } catch (exn) { if (old_trav) { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } flip_ongoing_traversal(h); - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -525,14 +516,10 @@ function filter_map_inplace(f, h) { return; } catch (exn) { if (old_trav) { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } flip_ongoing_traversal(h); - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -568,14 +555,10 @@ function fold(f, h, init) { return accu; } catch (exn) { if (old_trav) { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } flip_ongoing_traversal(h); - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -654,11 +637,10 @@ function MakeSeeded(H) { let find = (h, key) => { let match = Caml_array.get(h.data, key_index(h, key)); if (typeof match !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k1 = match.key; let d1 = match.data; @@ -667,11 +649,10 @@ function MakeSeeded(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k2 = next1.key; let d2 = next1.data; @@ -680,11 +661,10 @@ function MakeSeeded(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k3 = next2.key; let d3 = next2.data; @@ -696,11 +676,10 @@ function MakeSeeded(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k = param.key; let data = param.data; @@ -900,11 +879,10 @@ function Make(H) { let find = (h, key) => { let match = Caml_array.get(h.data, key_index(h, key)); if (typeof match !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k1 = match.key; let d1 = match.data; @@ -913,11 +891,10 @@ function Make(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k2 = next1.key; let d2 = next1.data; @@ -926,11 +903,10 @@ function Make(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k3 = next2.key; let d3 = next2.data; @@ -942,11 +918,10 @@ function Make(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k = param.key; let data = param.data; diff --git a/lib/es6/int32.js b/lib/es6/int32.js index 044b7687ef..dff650c3e9 100644 --- a/lib/es6/int32.js +++ b/lib/es6/int32.js @@ -36,9 +36,7 @@ function of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/int64.js b/lib/es6/int64.js index 1c102d7b2f..37fd9241c7 100644 --- a/lib/es6/int64.js +++ b/lib/es6/int64.js @@ -29,9 +29,7 @@ function of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/js_exn.js b/lib/es6/js_exn.js index 5d9a1f8fa9..74add0dd3a 100644 --- a/lib/es6/js_exn.js +++ b/lib/es6/js_exn.js @@ -2,45 +2,31 @@ function raiseError(str) { - throw new Error(new Error(str).RE_EXN_ID, { - cause: new Error(str) - }); + throw new Error(str); } function raiseEvalError(str) { - throw new Error(new EvalError(str).RE_EXN_ID, { - cause: new EvalError(str) - }); + throw new EvalError(str); } function raiseRangeError(str) { - throw new Error(new RangeError(str).RE_EXN_ID, { - cause: new RangeError(str) - }); + throw new RangeError(str); } function raiseReferenceError(str) { - throw new Error(new ReferenceError(str).RE_EXN_ID, { - cause: new ReferenceError(str) - }); + throw new ReferenceError(str); } function raiseSyntaxError(str) { - throw new Error(new SyntaxError(str).RE_EXN_ID, { - cause: new SyntaxError(str) - }); + throw new SyntaxError(str); } function raiseTypeError(str) { - throw new Error(new TypeError(str).RE_EXN_ID, { - cause: new TypeError(str) - }); + throw new TypeError(str); } function raiseUriError(str) { - throw new Error(new URIError(str).RE_EXN_ID, { - cause: new URIError(str) - }); + throw new URIError(str); } let $$Error$1 = "JsError"; diff --git a/lib/es6/js_null.js b/lib/es6/js_null.js index 4a30b70360..9ac6a94514 100644 --- a/lib/es6/js_null.js +++ b/lib/es6/js_null.js @@ -10,9 +10,7 @@ function getExn(f) { if (f !== null) { return f; } - throw new Error(new Error("Js.Null.getExn").RE_EXN_ID, { - cause: new Error("Js.Null.getExn") - }); + throw new Error("Js.Null.getExn"); } function bind(x, f) { diff --git a/lib/es6/js_option.js b/lib/es6/js_option.js index b24505acab..0667fcd74d 100644 --- a/lib/es6/js_option.js +++ b/lib/es6/js_option.js @@ -26,9 +26,7 @@ function getExn(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error(new Error("getExn").RE_EXN_ID, { - cause: new Error("getExn") - }); + throw new Error("getExn"); } function equal(eq, a, b) { diff --git a/lib/es6/js_undefined.js b/lib/es6/js_undefined.js index 762283d3da..8d5125bc03 100644 --- a/lib/es6/js_undefined.js +++ b/lib/es6/js_undefined.js @@ -14,9 +14,7 @@ function getExn(f) { if (f !== undefined) { return f; } - throw new Error(new Error("Js.Undefined.getExn").RE_EXN_ID, { - cause: new Error("Js.Undefined.getExn") - }); + throw new Error("Js.Undefined.getExn"); } function bind(x, f) { diff --git a/lib/es6/lexing.js b/lib/es6/lexing.js index cb6ad1c864..33175bdb02 100644 --- a/lib/es6/lexing.js +++ b/lib/es6/lexing.js @@ -54,12 +54,11 @@ function from_function(f) { } else { let newlen = (x.lex_buffer.length << 1); if (((x.lex_buffer_len - x.lex_start_pos | 0) + n | 0) > newlen) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Lexing.lex_refill: cannot grow buffer" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Lexing.lex_refill: cannot grow buffer", + Error: new Error() + }; } let newbuf = Caml_bytes.create(newlen); Bytes.blit(x.lex_buffer, x.lex_start_pos, newbuf, 0, x.lex_buffer_len - x.lex_start_pos | 0); diff --git a/lib/es6/list.js b/lib/es6/list.js index 09ebf99bde..0143699d17 100644 --- a/lib/es6/list.js +++ b/lib/es6/list.js @@ -30,34 +30,31 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "hd", + Error: new Error() + }; } function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "tl", + Error: new Error() + }; } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -72,23 +69,21 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "nth", + Error: new Error() + }; }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -156,12 +151,11 @@ function init_aux(i, n, f) { function init(len, f) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } if (len > 10000) { return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); @@ -280,22 +274,20 @@ function map2(f, l1, l2) { tl: map2(f, l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } function rev_map2(f, l1, l2) { @@ -316,20 +308,18 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } return accu; }; @@ -346,22 +336,20 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; }; } @@ -377,20 +365,18 @@ function fold_left2(f, _accu, _l1, _l2) { _accu = f(accu, l1.hd, l2.hd); continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } return accu; }; @@ -401,20 +387,18 @@ function fold_right2(f, l1, l2, accu) { if (l2) { return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } return accu; } @@ -460,22 +444,20 @@ function for_all2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; }; } @@ -492,22 +474,20 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; }; } @@ -550,11 +530,10 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -584,11 +563,10 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -678,11 +656,10 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -790,22 +767,20 @@ function combine(l1, l2) { tl: combine(l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } function merge(cmp, l1, l2) { @@ -842,16 +817,15 @@ function chop(_k, _l) { _k = k - 1 | 0; continue; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "list.res", - 420, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "list.res", + 420, + 11 + ], + Error: new Error() + }; }; } diff --git a/lib/es6/listLabels.js b/lib/es6/listLabels.js index b614cbfc27..e85c6163f4 100644 --- a/lib/es6/listLabels.js +++ b/lib/es6/listLabels.js @@ -30,34 +30,31 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "hd", + Error: new Error() + }; } function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "tl", + Error: new Error() + }; } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -72,23 +69,21 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "nth", + Error: new Error() + }; }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -156,12 +151,11 @@ function init_aux(i, n, f) { function init(len, f) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } if (len > 10000) { return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); @@ -280,22 +274,20 @@ function map2(f, l1, l2) { tl: map2(f, l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } function rev_map2(f, l1, l2) { @@ -316,20 +308,18 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } return accu; }; @@ -346,22 +336,20 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; }; } @@ -377,20 +365,18 @@ function fold_left2(f, _accu, _l1, _l2) { _accu = f(accu, l1.hd, l2.hd); continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } return accu; }; @@ -401,20 +387,18 @@ function fold_right2(f, l1, l2, accu) { if (l2) { return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } return accu; } @@ -460,22 +444,20 @@ function for_all2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; }; } @@ -492,22 +474,20 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; }; } @@ -550,11 +530,10 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -584,11 +563,10 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -678,11 +656,10 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -790,22 +767,20 @@ function combine(l1, l2) { tl: combine(l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } function merge(cmp, l1, l2) { @@ -842,16 +817,15 @@ function chop(_k, _l) { _k = k - 1 | 0; continue; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "listLabels.res", - 420, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "listLabels.res", + 420, + 11 + ], + Error: new Error() + }; }; } diff --git a/lib/es6/map.js b/lib/es6/map.js index 2052415d99..6829c40962 100644 --- a/lib/es6/map.js +++ b/lib/es6/map.js @@ -37,12 +37,11 @@ function Make(funarg) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -54,12 +53,11 @@ function Make(funarg) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -72,12 +70,11 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -89,12 +86,11 @@ function Make(funarg) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = param => { if (typeof param !== "object") { @@ -152,11 +148,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = funarg.compare(x, param.v); if (c === 0) { @@ -170,11 +165,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -246,11 +240,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -350,11 +343,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -388,11 +380,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -424,12 +415,11 @@ function Make(funarg) { }; let remove_min_binding = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -717,16 +707,15 @@ function Make(funarg) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); diff --git a/lib/es6/mapLabels.js b/lib/es6/mapLabels.js index c791c85f85..713328179b 100644 --- a/lib/es6/mapLabels.js +++ b/lib/es6/mapLabels.js @@ -37,12 +37,11 @@ function Make(Ord) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -54,12 +53,11 @@ function Make(Ord) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -72,12 +70,11 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -89,12 +86,11 @@ function Make(Ord) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = param => { if (typeof param !== "object") { @@ -152,11 +148,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Ord.compare(x, param.v); if (c === 0) { @@ -192,11 +187,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -268,11 +262,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -350,11 +343,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -388,11 +380,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -424,12 +415,11 @@ function Make(Ord) { }; let remove_min_binding = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -717,16 +707,15 @@ function Make(Ord) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); diff --git a/lib/es6/moreLabels.js b/lib/es6/moreLabels.js index 5ab48c2721..e42e900b6e 100644 --- a/lib/es6/moreLabels.js +++ b/lib/es6/moreLabels.js @@ -67,12 +67,11 @@ let $$Map = { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -84,12 +83,11 @@ let $$Map = { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -102,12 +100,11 @@ let $$Map = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -119,12 +116,11 @@ let $$Map = { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = param => { if (typeof param !== "object") { @@ -182,11 +178,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = funarg.compare(x, param.v); if (c === 0) { @@ -222,11 +217,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -298,11 +292,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -380,11 +373,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -418,11 +410,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -454,12 +445,11 @@ let $$Map = { }; let remove_min_binding = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -747,16 +737,15 @@ let $$Map = { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); @@ -1011,12 +1000,11 @@ let $$Set = { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -1027,12 +1015,11 @@ let $$Set = { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -1044,12 +1031,11 @@ let $$Set = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -1060,12 +1046,11 @@ let $$Set = { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, param) => { if (typeof param !== "object") { @@ -1141,11 +1126,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1173,11 +1157,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -1203,12 +1186,11 @@ let $$Set = { }; let remove_min_elt = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1598,11 +1580,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = funarg.compare(x, v); @@ -1634,11 +1615,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1700,11 +1680,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1874,16 +1853,15 @@ let $$Set = { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l), l)[0]; }; diff --git a/lib/es6/parsing.js b/lib/es6/parsing.js index c2eb456f4f..e882967d42 100644 --- a/lib/es6/parsing.js +++ b/lib/es6/parsing.js @@ -85,11 +85,10 @@ function yyparse(tables, start, lexer, lexbuf) { _cmd = "Token_read"; continue; case "Raise_parse_error" : - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; case "Grow_stacks_1" : grow_stacks(); _arg = undefined; @@ -115,9 +114,7 @@ function yyparse(tables, start, lexer, lexbuf) { undefined ]; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } _arg = match$1[1]; @@ -150,9 +147,7 @@ function yyparse(tables, start, lexer, lexbuf) { return Caml_array.get(tables.transl_const, tok) === curr_char; } }; - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } diff --git a/lib/es6/pervasives.js b/lib/es6/pervasives.js index e066b6e51c..ef8e3d41a5 100644 --- a/lib/es6/pervasives.js +++ b/lib/es6/pervasives.js @@ -7,21 +7,19 @@ import * as Caml_exceptions from "./caml_exceptions.js"; import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function failwith(s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } - }); + throw { + RE_EXN_ID: "Failure", + _1: s, + Error: new Error() + }; } function invalid_arg(s) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } let Exit = /* @__PURE__ */Caml_exceptions.create("Pervasives.Exit"); @@ -58,12 +56,11 @@ function classify_float(x) { function char_of_int(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "char_of_int" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "char_of_int", + Error: new Error() + }; } return n; } @@ -83,12 +80,11 @@ function bool_of_string(param) { case "true" : return true; default: - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "bool_of_string" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "bool_of_string", + Error: new Error() + }; } } @@ -111,9 +107,7 @@ function int_of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -153,9 +147,7 @@ function float_of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/queue.js b/lib/es6/queue.js index 72b301fa5f..060df8ec7e 100644 --- a/lib/es6/queue.js +++ b/lib/es6/queue.js @@ -41,21 +41,19 @@ function peek(q) { if (typeof match === "object") { return match.content; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } function take(q) { let match = q.first; if (typeof match !== "object") { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } let content = match.content; let next = match.next; diff --git a/lib/es6/random.js b/lib/es6/random.js index eecb439f2f..e73c109347 100644 --- a/lib/es6/random.js +++ b/lib/es6/random.js @@ -71,12 +71,11 @@ function bits(s) { function int(s, bound) { if (bound > 1073741823 || bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int", + Error: new Error() + }; } while (true) { let r = bits(s); @@ -90,12 +89,11 @@ function int(s, bound) { function int32(s, bound) { if (bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int32" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32", + Error: new Error() + }; } while (true) { let b1 = bits(s); @@ -111,12 +109,11 @@ function int32(s, bound) { function int64(s, bound) { if (Caml.i64_le(bound, Caml_int64.zero)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int64" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64", + Error: new Error() + }; } while (true) { let b1 = Caml_int64.of_int32(bits(s)); diff --git a/lib/es6/runtime_deriving.js b/lib/es6/runtime_deriving.js index 36b9eb01d8..a5299e3648 100644 --- a/lib/es6/runtime_deriving.js +++ b/lib/es6/runtime_deriving.js @@ -3,11 +3,10 @@ function raiseWhenNotFound(x) { if (x == null) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } return x; } diff --git a/lib/es6/set.js b/lib/es6/set.js index 214de70318..dbebe6a6a9 100644 --- a/lib/es6/set.js +++ b/lib/es6/set.js @@ -31,12 +31,11 @@ function Make(funarg) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -47,12 +46,11 @@ function Make(funarg) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -64,12 +62,11 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -80,12 +77,11 @@ function Make(funarg) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, param) => { if (typeof param !== "object") { @@ -161,11 +157,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -193,11 +188,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -223,12 +217,11 @@ function Make(funarg) { }; let remove_min_elt = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -616,11 +609,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = funarg.compare(x, v); @@ -635,11 +627,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -699,11 +690,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -906,16 +896,15 @@ function Make(funarg) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l$1), l$1)[0]; } else { diff --git a/lib/es6/setLabels.js b/lib/es6/setLabels.js index 604cad1ec7..f803387202 100644 --- a/lib/es6/setLabels.js +++ b/lib/es6/setLabels.js @@ -31,12 +31,11 @@ function Make(Ord) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -47,12 +46,11 @@ function Make(Ord) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -64,12 +62,11 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -80,12 +77,11 @@ function Make(Ord) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, param) => { if (typeof param !== "object") { @@ -161,11 +157,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -193,11 +188,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -223,12 +217,11 @@ function Make(Ord) { }; let remove_min_elt = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -618,11 +611,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = Ord.compare(x, v); @@ -654,11 +646,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -720,11 +711,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -894,16 +884,15 @@ function Make(Ord) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l), l)[0]; }; diff --git a/lib/es6/sort.js b/lib/es6/sort.js index 98d609d6e5..cc9d550760 100644 --- a/lib/es6/sort.js +++ b/lib/es6/sort.js @@ -114,12 +114,11 @@ function array(cmp, arr) { let i = lo + 1 | 0; let j = hi - 1 | 0; if (!cmp(pivot, arr[hi]) || !cmp(arr[lo], pivot)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Sort.array" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Sort.array", + Error: new Error() + }; } while (i < j) { while (!cmp(pivot, arr[i])) { diff --git a/lib/es6/stack.js b/lib/es6/stack.js index 147171622d..2ae12c6064 100644 --- a/lib/es6/stack.js +++ b/lib/es6/stack.js @@ -39,11 +39,10 @@ function pop(s) { s.len = s.len - 1 | 0; return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } function top(s) { @@ -51,11 +50,10 @@ function top(s) { if (match) { return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } function is_empty(s) { diff --git a/lib/es6/stream.js b/lib/es6/stream.js index 2ed7fbfc14..6e0c953032 100644 --- a/lib/es6/stream.js +++ b/lib/es6/stream.js @@ -54,16 +54,15 @@ function get_data(count, _d) { } }; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stream.res", - 53, - 13 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 53, + 13 + ], + Error: new Error() + }; case "Slazy" : _d = CamlinternalLazy.force(d._0); continue; @@ -116,16 +115,15 @@ function peek_data(s) { s.data = d; return Caml_option.some(d._0); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stream.res", - 83, - 13 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 83, + 13 + ], + Error: new Error() + }; case "Slazy" : s.data = CamlinternalLazy.force(f._0); continue; @@ -234,11 +232,10 @@ function next(s) { junk(s); return Caml_option.valFromOption(a); } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw { + RE_EXN_ID: Failure, + Error: new Error() + }; } function empty(s) { @@ -246,11 +243,10 @@ function empty(s) { if (match === undefined) { return; } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw { + RE_EXN_ID: Failure, + Error: new Error() + }; } function iter(f, strm) { diff --git a/lib/es6/string.js b/lib/es6/string.js index 85e4d17c82..55e9b890cc 100644 --- a/lib/es6/string.js +++ b/lib/es6/string.js @@ -90,11 +90,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -129,12 +128,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -142,12 +140,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -156,11 +153,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -176,12 +172,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -206,12 +201,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -219,12 +213,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -234,9 +227,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -246,12 +237,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -261,9 +251,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/stringLabels.js b/lib/es6/stringLabels.js index 72980fb1bb..789a8ff622 100644 --- a/lib/es6/stringLabels.js +++ b/lib/es6/stringLabels.js @@ -92,11 +92,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -131,12 +130,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -144,12 +142,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -158,11 +155,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -178,12 +174,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -208,12 +203,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -221,12 +215,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -236,9 +229,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -248,12 +239,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -263,9 +253,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/es6/uchar.js b/lib/es6/uchar.js index c75c5caada..8ffb9e2054 100644 --- a/lib/es6/uchar.js +++ b/lib/es6/uchar.js @@ -16,12 +16,11 @@ function succ(u) { return 57344; } if (u === 1114111) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+10FFFF has no successor" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor", + Error: new Error() + }; } return u + 1 | 0; } @@ -31,12 +30,11 @@ function pred(u) { return 55295; } if (u === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+0000 has no predecessor" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor", + Error: new Error() + }; } return u - 1 | 0; } @@ -56,12 +54,11 @@ function of_int(i) { return i; } let s = err_not_sv(i); - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } function is_char(u) { @@ -77,12 +74,11 @@ function to_char(u) { return u; } let s = err_not_latin1(u); - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } function unsafe_to_char(prim) { diff --git a/lib/js/arg.js b/lib/js/arg.js index 89c4a76246..f606de0d6b 100644 --- a/lib/js/arg.js +++ b/lib/js/arg.js @@ -31,11 +31,10 @@ function assoc3(x, _l) { _l = l.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -57,15 +56,14 @@ function make_symlist(prefix, sep, suffix, l) { } function help_action() { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Unknown", - _0: "-help" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: "-help" + }, + Error: new Error() + }; } function add_help(speclist) { @@ -88,9 +86,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let add2; @@ -112,9 +108,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } return Pervasives.$at(speclist, Pervasives.$at(add1, add2)); @@ -159,9 +153,7 @@ function bool_of_string_opt(x) { if (exn.RE_EXN_ID === "Invalid_argument") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -173,9 +165,7 @@ function int_of_string_opt(x) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -187,9 +177,7 @@ function float_of_string_opt(x) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -261,24 +249,19 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } catch (raw_exn$1) { let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); if (exn$1.RE_EXN_ID === "Not_found") { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Unknown", - _0: s - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: s + }, + Error: new Error() + }; } - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let follow = match[1]; @@ -286,17 +269,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (follow === undefined) { return; } - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: follow, - _2: "no argument" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: follow, + _2: "no argument" + }, + Error: new Error() + }; }; let get_arg = () => { if (follow !== undefined) { @@ -305,15 +287,14 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if ((current.contents + 1 | 0) < argv.contents.length) { return Caml_array.get(argv.contents, current.contents + 1 | 0); } - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Missing", - _0: s - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Missing", + _0: s + }, + Error: new Error() + }; }; let consume_arg = () => { if (follow !== undefined) { @@ -333,17 +314,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (s$1 !== undefined) { f._0(s$1); } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg, - _2: "a boolean" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg, + _2: "a boolean" + }, + Error: new Error() + }; } return consume_arg(); case "Set" : @@ -367,17 +347,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x !== undefined) { f._0(x); } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$2, - _2: "an integer" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$2, + _2: "an integer" + }, + Error: new Error() + }; } return consume_arg(); case "Set_int" : @@ -386,17 +365,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x$1 !== undefined) { f._0.contents = x$1; } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$3, - _2: "an integer" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$3, + _2: "an integer" + }, + Error: new Error() + }; } return consume_arg(); case "Float" : @@ -405,17 +383,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x$2 !== undefined) { f._0(x$2); } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$4, - _2: "a float" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$4, + _2: "a float" + }, + Error: new Error() + }; } return consume_arg(); case "Set_float" : @@ -424,17 +401,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist if (x$3 !== undefined) { f._0.contents = x$3; } else { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$5, - _2: "a float" - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$5, + _2: "a float" + }, + Error: new Error() + }; } return consume_arg(); case "Tuple" : @@ -446,17 +422,16 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist f._1(arg$6); return consume_arg(); } - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Wrong", - _0: s, - _1: arg$6, - _2: "one of: " + make_symlist("", " ", "", symb) - } - } - }); + throw { + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$6, + _2: "one of: " + make_symlist("", " ", "", symb) + }, + Error: new Error() + }; case "Rest" : let f$1 = f._0; while (current.contents < (argv.contents.length - 1 | 0)) { @@ -466,12 +441,11 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist return; case "Expand" : if (!allow_expand) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Arg.Expand is is only allowed with Arg.parse_and_expand_argv_dynamic" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Arg.Expand is is only allowed with Arg.parse_and_expand_argv_dynamic", + Error: new Error() + }; } let arg$7 = get_arg(); let newarg = f._0(arg$7); @@ -498,24 +472,15 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist } catch (raw_m) { let m = Caml_js_exceptions.internalToOCamlException(raw_m); if (m.RE_EXN_ID === Bad) { - throw new Error(convert_error({ + throw convert_error({ TAG: "Message", _0: m._1 - }).RE_EXN_ID, { - cause: convert_error({ - TAG: "Message", - _0: m._1 - }) }); } if (m.RE_EXN_ID === Stop) { - throw new Error(convert_error(m._1).RE_EXN_ID, { - cause: convert_error(m._1) - }); + throw convert_error(m._1); } - throw new Error(m.RE_EXN_ID, { - cause: m - }); + throw m; } current.contents = current.contents + 1 | 0; }; @@ -552,9 +517,7 @@ function parse(l, f, msg) { console.log(msg$1._1); return Pervasives.exit(0); } - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } @@ -571,9 +534,7 @@ function parse_dynamic(l, f, msg) { console.log(msg$1._1); return Pervasives.exit(0); } - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } @@ -599,9 +560,7 @@ function parse_expand(l, f, msg) { console.log(msg$1._1); return Pervasives.exit(0); } - throw new Error(msg$1.RE_EXN_ID, { - cause: msg$1 - }); + throw msg$1; } } @@ -636,18 +595,14 @@ function second_word(s) { if (exn$1.RE_EXN_ID === "Not_found") { return len; } - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } if (exit === 2) { return loop(n$1 + 1 | 0); } } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } return loop(n + 1 | 0); diff --git a/lib/js/array.js b/lib/js/array.js index 8bdf08b552..b262d5b67b 100644 --- a/lib/js/array.js +++ b/lib/js/array.js @@ -14,12 +14,11 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.init", + Error: new Error() + }; } let res = Caml_array.make(l, f(0)); for (let i = 1; i < l; ++i) { @@ -58,24 +57,22 @@ function append(a1, a2) { function sub(a, ofs, len) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } return Caml_array.sub(a, ofs, len); } function fill(a, ofs, len, v) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill", + Error: new Error() + }; } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { a[i] = v; @@ -84,12 +81,11 @@ function fill(a, ofs, len, v) { function blit(a1, ofs1, a2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } Caml_array.blit(a1, ofs1, a2, ofs2, len); } @@ -102,12 +98,11 @@ function iter(f, a) { function iter2(f, a, b) { if (a.length !== b.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.iter2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length", + Error: new Error() + }; } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { f(a[i], b[i]); @@ -130,12 +125,11 @@ function map2(f, a, b) { let la = a.length; let lb = b.length; if (la !== lb) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.map2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length", + Error: new Error() + }; } if (la === 0) { return []; @@ -317,12 +311,11 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } - }); + throw { + RE_EXN_ID: Bottom, + _1: i, + Error: new Error() + }; }; let trickle = (l, i, e) => { try { @@ -342,9 +335,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return Caml_array.set(a, i$2._1, e); } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let bubble = (l, i) => { @@ -362,9 +353,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return i$2._1; } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let trickleup = (_i, e) => { @@ -372,16 +361,15 @@ function sort(cmp, a) { let i = _i; let father = (i - 1 | 0) / 3 | 0; if (i === father) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "array.res", - 321, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "array.res", + 321, + 4 + ], + Error: new Error() + }; } if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); diff --git a/lib/js/arrayLabels.js b/lib/js/arrayLabels.js index cc4be0533e..bec5ae1c21 100644 --- a/lib/js/arrayLabels.js +++ b/lib/js/arrayLabels.js @@ -14,12 +14,11 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.init", + Error: new Error() + }; } let res = Caml_array.make(l, f(0)); for (let i = 1; i < l; ++i) { @@ -58,24 +57,22 @@ function append(a1, a2) { function sub(a, ofs, len) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub", + Error: new Error() + }; } return Caml_array.sub(a, ofs, len); } function fill(a, ofs, len, v) { if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill", + Error: new Error() + }; } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { a[i] = v; @@ -84,12 +81,11 @@ function fill(a, ofs, len, v) { function blit(a1, ofs1, a2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit", + Error: new Error() + }; } Caml_array.blit(a1, ofs1, a2, ofs2, len); } @@ -102,12 +98,11 @@ function iter(f, a) { function iter2(f, a, b) { if (a.length !== b.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.iter2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length", + Error: new Error() + }; } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { f(a[i], b[i]); @@ -130,12 +125,11 @@ function map2(f, a, b) { let la = a.length; let lb = b.length; if (la !== lb) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.map2: arrays must have the same length" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length", + Error: new Error() + }; } if (la === 0) { return []; @@ -317,12 +311,11 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } - }); + throw { + RE_EXN_ID: Bottom, + _1: i, + Error: new Error() + }; }; let trickle = (l, i, e) => { try { @@ -342,9 +335,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return Caml_array.set(a, i$2._1, e); } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let bubble = (l, i) => { @@ -362,9 +353,7 @@ function sort(cmp, a) { if (i$2.RE_EXN_ID === Bottom) { return i$2._1; } - throw new Error(i$2.RE_EXN_ID, { - cause: i$2 - }); + throw i$2; } }; let trickleup = (_i, e) => { @@ -372,16 +361,15 @@ function sort(cmp, a) { let i = _i; let father = (i - 1 | 0) / 3 | 0; if (i === father) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "arrayLabels.res", - 321, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "arrayLabels.res", + 321, + 4 + ], + Error: new Error() + }; } if (cmp(Caml_array.get(a, father), e) >= 0) { return Caml_array.set(a, i, e); diff --git a/lib/js/belt_Array.js b/lib/js/belt_Array.js index db7b6440a2..16962fb170 100644 --- a/lib/js/belt_Array.js +++ b/lib/js/belt_Array.js @@ -12,16 +12,15 @@ function get(arr, i) { function getExn(arr, i) { if (!(i >= 0 && i < arr.length)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_Array.res", - 36, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 36, + 2 + ], + Error: new Error() + }; } return arr[i]; } @@ -37,16 +36,15 @@ function set(arr, i, v) { function setExn(arr, i, v) { if (!(i >= 0 && i < arr.length)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_Array.res", - 49, - 2 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 49, + 2 + ], + Error: new Error() + }; } arr[i] = v; } diff --git a/lib/js/belt_List.js b/lib/js/belt_List.js index 0cbe6919bc..05e7f60db8 100644 --- a/lib/js/belt_List.js +++ b/lib/js/belt_List.js @@ -15,11 +15,10 @@ function headExn(x) { if (x) { return x.hd; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function tail(x) { @@ -33,11 +32,10 @@ function tailExn(x) { if (x) { return x.tl; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function add(xs, x) { @@ -71,11 +69,10 @@ function get(x, n) { function getExn(x, n) { if (n < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let _x = x; let _n = n; @@ -90,11 +87,10 @@ function getExn(x, n) { _x = x$1.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/belt_MutableQueue.js b/lib/js/belt_MutableQueue.js index 99bec2dd73..45ce2b1b62 100644 --- a/lib/js/belt_MutableQueue.js +++ b/lib/js/belt_MutableQueue.js @@ -54,11 +54,10 @@ function peekExn(q) { if (v !== undefined) { return v.content; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function pop(q) { @@ -90,11 +89,10 @@ function popExn(q) { return x.content; } } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function popUndefined(q) { diff --git a/lib/js/belt_Option.js b/lib/js/belt_Option.js index cc15d6aeeb..c4f301c2b5 100644 --- a/lib/js/belt_Option.js +++ b/lib/js/belt_Option.js @@ -20,11 +20,10 @@ function getExn(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function mapWithDefault(opt, $$default, f) { diff --git a/lib/js/belt_Result.js b/lib/js/belt_Result.js index accb607746..e221ef9d71 100644 --- a/lib/js/belt_Result.js +++ b/lib/js/belt_Result.js @@ -5,11 +5,10 @@ function getExn(x) { if (x.TAG === "Ok") { return x._0; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } function mapWithDefault(opt, $$default, f) { diff --git a/lib/js/belt_internalAVLset.js b/lib/js/belt_internalAVLset.js index bd0e013f01..3580ec8f6c 100644 --- a/lib/js/belt_internalAVLset.js +++ b/lib/js/belt_internalAVLset.js @@ -349,16 +349,15 @@ function checkInvariantInternal(_v) { r !== undefined ? r.h : 0 ) | 0; if (!(diff <= 2 && diff >= -2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_internalAVLset.res", - 310, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLset.res", + 310, + 4 + ], + Error: new Error() + }; } checkInvariantInternal(l); _v = r; @@ -700,11 +699,10 @@ function getExn(_n, x, cmp) { _n = c < 0 ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/belt_internalAVLtree.js b/lib/js/belt_internalAVLtree.js index 825157acc4..9fd0ebe1bf 100644 --- a/lib/js/belt_internalAVLtree.js +++ b/lib/js/belt_internalAVLtree.js @@ -546,16 +546,15 @@ function checkInvariantInternal(_v) { let r = v.r; let diff = treeHeight(l) - treeHeight(r) | 0; if (!(diff <= 2 && diff >= -2)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "belt_internalAVLtree.res", - 439, - 4 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLtree.res", + 439, + 4 + ], + Error: new Error() + }; } checkInvariantInternal(l); _v = r; @@ -849,11 +848,10 @@ function getExn(_n, x, cmp) { _n = c < 0 ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/belt_internalMapInt.js b/lib/js/belt_internalMapInt.js index 033567d0f4..969acf741e 100644 --- a/lib/js/belt_internalMapInt.js +++ b/lib/js/belt_internalMapInt.js @@ -62,11 +62,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/belt_internalMapString.js b/lib/js/belt_internalMapString.js index 0db017ec4e..a371514a69 100644 --- a/lib/js/belt_internalMapString.js +++ b/lib/js/belt_internalMapString.js @@ -62,11 +62,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/belt_internalSetInt.js b/lib/js/belt_internalSetInt.js index d319345d87..211b1cd049 100644 --- a/lib/js/belt_internalSetInt.js +++ b/lib/js/belt_internalSetInt.js @@ -141,11 +141,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/belt_internalSetString.js b/lib/js/belt_internalSetString.js index de811887c7..d591e8b41e 100644 --- a/lib/js/belt_internalSetString.js +++ b/lib/js/belt_internalSetString.js @@ -141,11 +141,10 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } diff --git a/lib/js/buffer.js b/lib/js/buffer.js index c59f4ffe76..6eedc8ab79 100644 --- a/lib/js/buffer.js +++ b/lib/js/buffer.js @@ -26,36 +26,33 @@ function to_bytes(b) { function sub(b, ofs, len) { if (ofs < 0 || len < 0 || ofs > (b.position - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub", + Error: new Error() + }; } return Bytes.sub_string(b.buffer, ofs, len); } function blit(src, srcoff, dst, dstoff, len) { if (len < 0 || srcoff < 0 || srcoff > (src.position - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit", + Error: new Error() + }; } Bytes.blit(src.buffer, srcoff, dst, dstoff, len); } function nth(b, ofs) { if (ofs < 0 || ofs >= b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth", + Error: new Error() + }; } return b.buffer[ofs]; } @@ -98,16 +95,15 @@ function add_char(b, c) { function add_utf_8_uchar(b, u) { let u$1 = u; if (u$1 < 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 98, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 98, + 18 + ], + Error: new Error() + }; } if (u$1 <= 127) { return add_char(b, u$1); @@ -145,31 +141,29 @@ function add_utf_8_uchar(b, u) { b.position = pos$2 + 4 | 0; return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 127, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 127, + 9 + ], + Error: new Error() + }; } function add_utf_16be_uchar(b, u) { let u$1 = u; if (u$1 < 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 132, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 132, + 18 + ], + Error: new Error() + }; } if (u$1 <= 65535) { let pos = b.position; @@ -196,31 +190,29 @@ function add_utf_16be_uchar(b, u) { b.position = pos$1 + 4 | 0; return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 154, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 154, + 9 + ], + Error: new Error() + }; } function add_utf_16le_uchar(b, u) { let u$1 = u; if (u$1 < 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 159, - 18 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 159, + 18 + ], + Error: new Error() + }; } if (u$1 <= 65535) { let pos = b.position; @@ -247,26 +239,24 @@ function add_utf_16le_uchar(b, u) { b.position = pos$1 + 4 | 0; return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 181, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 181, + 9 + ], + Error: new Error() + }; } function add_substring(b, s, offset, len) { if (offset < 0 || len < 0 || offset > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.add_substring/add_subbytes" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.add_substring/add_subbytes", + Error: new Error() + }; } let new_position = b.position + len | 0; if (new_position > b.length) { @@ -305,16 +295,15 @@ function closing(param) { if (param === 123) { return /* '}' */125; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "buffer.res", - 216, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 216, + 9 + ], + Error: new Error() + }; } function advance_to_closing(opening, closing, k, s, start) { @@ -325,11 +314,10 @@ function advance_to_closing(opening, closing, k, s, start) { let i = _i; let k$1 = _k; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (Caml_string.get(s, i) === opening) { _i = i + 1 | 0; @@ -383,11 +371,10 @@ function advance_to_non_alpha(s, start) { function find_ident(s, start, lim) { if (start >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Caml_string.get(s, start); if (c !== 40 && c !== 123) { @@ -455,12 +442,11 @@ function add_substitute(b, f, s) { function truncate(b, len) { if (len < 0 || len > b.position) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Buffer.truncate" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate", + Error: new Error() + }; } b.position = len; } diff --git a/lib/js/bytes.js b/lib/js/bytes.js index b404268df9..13d10fe842 100644 --- a/lib/js/bytes.js +++ b/lib/js/bytes.js @@ -110,12 +110,11 @@ function of_string(s) { function sub(s, ofs, len) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.sub / Bytes.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub", + Error: new Error() + }; } let r = Caml_bytes.create(len); unsafe_blit(s, ofs, r, 0, len); @@ -138,23 +137,21 @@ function $plus$plus(a, b) { if (match$2) { return c; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } return c; } @@ -180,36 +177,33 @@ function extend(s, left, right) { function fill(s, ofs, len, c) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } unsafe_fill(s, ofs, len, c); } function blit(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } unsafe_blit(s1, ofs1, s2, ofs2, len); } function blit_string(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } if (len <= 0) { return; @@ -245,12 +239,11 @@ function ensure_ge(x, y) { if (x >= y) { return x; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.concat" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat", + Error: new Error() + }; } function sum_lengths(_acc, seplen, _param) { @@ -489,11 +482,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -528,12 +520,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -541,12 +532,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -555,11 +545,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -575,12 +564,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -605,12 +593,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -618,12 +605,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -633,9 +619,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,12 +629,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -660,9 +643,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/bytesLabels.js b/lib/js/bytesLabels.js index b404268df9..13d10fe842 100644 --- a/lib/js/bytesLabels.js +++ b/lib/js/bytesLabels.js @@ -110,12 +110,11 @@ function of_string(s) { function sub(s, ofs, len) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.sub / Bytes.sub" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub", + Error: new Error() + }; } let r = Caml_bytes.create(len); unsafe_blit(s, ofs, r, 0, len); @@ -138,23 +137,21 @@ function $plus$plus(a, b) { if (match$2) { return c; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend", + Error: new Error() + }; } return c; } @@ -180,36 +177,33 @@ function extend(s, left, right) { function fill(s, ofs, len, c) { if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.fill / Bytes.fill" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill", + Error: new Error() + }; } unsafe_fill(s, ofs, len, c); } function blit(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.blit" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit", + Error: new Error() + }; } unsafe_blit(s1, ofs1, s2, ofs2, len); } function blit_string(s1, ofs1, s2, ofs2, len) { if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.blit / Bytes.blit_string" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string", + Error: new Error() + }; } if (len <= 0) { return; @@ -245,12 +239,11 @@ function ensure_ge(x, y) { if (x >= y) { return x; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.concat" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat", + Error: new Error() + }; } function sum_lengths(_acc, seplen, _param) { @@ -489,11 +482,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -528,12 +520,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -541,12 +532,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -555,11 +545,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s[i] === c) { return i; @@ -575,12 +564,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -605,12 +593,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -618,12 +605,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -633,9 +619,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,12 +629,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -660,9 +643,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/caml_array.js b/lib/js/caml_array.js index 64193ae514..b04e555508 100644 --- a/lib/js/caml_array.js +++ b/lib/js/caml_array.js @@ -57,24 +57,22 @@ function concat(l) { function set(xs, index, newval) { if (index < 0 || index >= xs.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } xs[index] = newval; } function get(xs, index) { if (index < 0 || index >= xs.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return xs[index]; } diff --git a/lib/js/caml_bigint.js b/lib/js/caml_bigint.js index 30cda2d9ce..b6031d5ed0 100644 --- a/lib/js/caml_bigint.js +++ b/lib/js/caml_bigint.js @@ -3,22 +3,20 @@ function div(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x / y; } function mod_(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x % y; } diff --git a/lib/js/caml_bytes.js b/lib/js/caml_bytes.js index b7909d1b9d..cc6553105a 100644 --- a/lib/js/caml_bytes.js +++ b/lib/js/caml_bytes.js @@ -3,36 +3,33 @@ function set(s, i, ch) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } s[i] = ch; } function get(s, i) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return s[i]; } function create(len) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.create" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.create", + Error: new Error() + }; } let result = new Array(len); for (let i = 0; i < len; ++i) { diff --git a/lib/js/caml_format.js b/lib/js/caml_format.js index 7ec916dc57..e663e5d2fd 100644 --- a/lib/js/caml_format.js +++ b/lib/js/caml_format.js @@ -129,12 +129,11 @@ function int_of_string(s) { let c = i < len ? s.codePointAt(i) : /* '\000' */0; let d = parse_digit(c); if (d < 0 || d >= base) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } let aux = (_acc, _k) => { while (true) { @@ -150,21 +149,19 @@ function int_of_string(s) { } let v = parse_digit(a); if (v < 0 || v >= base) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } let acc$1 = base * acc + v; if (acc$1 > threshold) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } _k = k + 1 | 0; _acc = acc$1; @@ -174,12 +171,11 @@ function int_of_string(s) { let res = match[1] * aux(d, i + 1 | 0); let or_res = res | 0; if (base === 10 && res !== or_res) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int_of_string", + Error: new Error() + }; } return or_res; } @@ -218,12 +214,11 @@ function int64_of_string(s) { let c = i < len ? s.codePointAt(i) : /* '\000' */0; let d = Caml_int64.of_int32(parse_digit(c)); if (Caml.i64_lt(d, Caml_int64.zero) || Caml.i64_ge(d, base)) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int64_of_string", + Error: new Error() + }; } let aux = (_acc, _k) => { while (true) { @@ -239,12 +234,11 @@ function int64_of_string(s) { } let v = Caml_int64.of_int32(parse_digit(a)); if (Caml.i64_lt(v, Caml_int64.zero) || Caml.i64_ge(v, base) || Caml.i64_gt(acc, threshold)) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int64_of_string", + Error: new Error() + }; } let acc$1 = Caml_int64.add(Caml_int64.mul(base, acc), v); _k = k + 1 | 0; @@ -258,12 +252,11 @@ function int64_of_string(s) { 0, 10 ]) && Caml.i64_neq(res, or_res)) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int64_of_string" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "int64_of_string", + Error: new Error() + }; } return or_res; } @@ -290,12 +283,11 @@ function lowercase(c) { function parse_format(fmt) { let len = fmt.length; if (len > 31) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "format_int: format too long" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "format_int: format too long", + Error: new Error() + }; } let f = { justify: "+", @@ -773,7 +765,7 @@ let float_of_string = (function(s,exn){ return Infinity; if (/^-inf(inity)?$/i.test(s)) return -Infinity; - throw new Error(exn.RE_EXN_ID, { cause: exn });; + throw exn; }); function float_of_string$1(s) { diff --git a/lib/js/caml_int32.js b/lib/js/caml_int32.js index 8bb64e9cba..348de87617 100644 --- a/lib/js/caml_int32.js +++ b/lib/js/caml_int32.js @@ -3,22 +3,20 @@ function div(x, y) { if (y === 0) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x / y | 0; } function mod_(x, y) { if (y === 0) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } return x % y; } diff --git a/lib/js/caml_int64.js b/lib/js/caml_int64.js index dcb3f8e08c..e83b0b310d 100644 --- a/lib/js/caml_int64.js +++ b/lib/js/caml_int64.js @@ -383,11 +383,10 @@ function div(_self, _other) { if (other[0] !== 0 || other[1] !== 0) { exit$1 = 2; } else { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw { + RE_EXN_ID: "Division_by_zero", + Error: new Error() + }; } if (exit$1 === 2) { if (self_hi !== -2147483648) { diff --git a/lib/js/caml_js_exceptions.js b/lib/js/caml_js_exceptions.js index 9fe06d0ffa..6d49e5228a 100644 --- a/lib/js/caml_js_exceptions.js +++ b/lib/js/caml_js_exceptions.js @@ -6,8 +6,8 @@ let Caml_exceptions = require("./caml_exceptions.js"); let $$Error = "JsError"; function internalToOCamlException(e) { - if (Caml_exceptions.is_extension(e.cause)) { - return e.cause; + if (Caml_exceptions.is_extension(e)) { + return e; } else { return { RE_EXN_ID: "JsError", diff --git a/lib/js/caml_lexer.js b/lib/js/caml_lexer.js index dfaf1adaca..1a5be6d097 100644 --- a/lib/js/caml_lexer.js +++ b/lib/js/caml_lexer.js @@ -87,7 +87,7 @@ let caml_lex_engine_aux = (function (tbl, start_state, lexbuf, exn){ if (state < 0) { lexbuf.lex_curr_pos = lexbuf.lex_last_pos; if (lexbuf.lex_last_action == -1) - throw new Error(exn.RE_EXN_ID, { cause: exn }) + throw exn else return lexbuf.lex_last_action; } @@ -222,7 +222,7 @@ let caml_new_lex_engine_aux = (function (tbl, start_state, lexbuf, exn) { if (state < 0) { lexbuf.lex_curr_pos = lexbuf.lex_last_pos; if (lexbuf.lex_last_action == -1) - throw new Error(exn.RE_EXN_ID, { cause: exn }); + throw exn; else return lexbuf.lex_last_action; } diff --git a/lib/js/caml_module.js b/lib/js/caml_module.js index b601cf66dd..f7caf02d8f 100644 --- a/lib/js/caml_module.js +++ b/lib/js/caml_module.js @@ -4,12 +4,11 @@ let Caml_obj = require("./caml_obj.js"); function init_mod(loc, shape) { let undef_module = param => { - throw new Error("Undefined_recursive_module", { - cause: { - RE_EXN_ID: "Undefined_recursive_module", - _1: loc - } - }); + throw { + RE_EXN_ID: "Undefined_recursive_module", + _1: loc, + Error: new Error() + }; }; let loop = (shape, struct_, idx) => { if (typeof shape !== "object") { @@ -74,16 +73,15 @@ function update_mod(shape, o, n) { } }; if (typeof shape !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "caml_module.res", - 109, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ], + Error: new Error() + }; } if (shape.TAG === "Module") { let comps = shape._0; @@ -94,16 +92,15 @@ function update_mod(shape, o, n) { } return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "caml_module.res", - 109, - 9 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ], + Error: new Error() + }; } exports.init_mod = init_mod; diff --git a/lib/js/caml_obj.js b/lib/js/caml_obj.js index 0b3f182a11..edfcef1be3 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -55,12 +55,11 @@ function compare(a, b) { break; case "function" : if (b_type === "function") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "compare: functional value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "compare: functional value", + Error: new Error() + }; } break; case "number" : @@ -136,12 +135,11 @@ function compare(a, b) { return Caml.int_compare(a[1], b[1]); } if (tag_a === 251) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; } if (tag_a !== tag_b) { if (tag_a < tag_b) { @@ -262,12 +260,11 @@ function equal(a, b) { } let b_type = typeof b; if (a_type === "function" || b_type === "function") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: functional value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: functional value", + Error: new Error() + }; } if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { return false; @@ -278,12 +275,11 @@ function equal(a, b) { return a[1] === b[1]; } if (tag_a === 251) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; } if (tag_a !== tag_b) { return false; diff --git a/lib/js/caml_string.js b/lib/js/caml_string.js index 252ba1b3fd..4ddd60890b 100644 --- a/lib/js/caml_string.js +++ b/lib/js/caml_string.js @@ -3,12 +3,11 @@ function get(s, i) { if (i >= s.length || i < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "index out of bounds" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds", + Error: new Error() + }; } return s.codePointAt(i); } diff --git a/lib/js/caml_sys.js b/lib/js/caml_sys.js index dae731f2ab..d2b6072de6 100644 --- a/lib/js/caml_sys.js +++ b/lib/js/caml_sys.js @@ -3,21 +3,19 @@ function sys_getenv(s) { if (typeof process === "undefined" || process.env === undefined) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let x = process.env[s]; if (x !== undefined) { return x; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let os_type = (function(_){ @@ -73,21 +71,19 @@ function sys_exit(exit_code) { } function sys_is_directory(_s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_is_directory not implemented" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "sys_is_directory not implemented", + Error: new Error() + }; } function sys_file_exists(_s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_file_exists not implemented" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "sys_file_exists not implemented", + Error: new Error() + }; } exports.sys_getenv = sys_getenv; diff --git a/lib/js/camlinternalLazy.js b/lib/js/camlinternalLazy.js index b92f4ac145..bf09987627 100644 --- a/lib/js/camlinternalLazy.js +++ b/lib/js/camlinternalLazy.js @@ -16,11 +16,10 @@ function forward_with_closure(blk, closure) { } function raise_undefined() { - throw new Error(Undefined, { - cause: { - RE_EXN_ID: Undefined - } - }); + throw { + RE_EXN_ID: Undefined, + Error: new Error() + }; } function force(lzv) { @@ -33,13 +32,9 @@ function force(lzv) { return forward_with_closure(lzv, closure); } catch (e) { lzv.VAL = () => { - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; }; - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } } } diff --git a/lib/js/char.js b/lib/js/char.js index 319b877a5b..7a4984f70b 100644 --- a/lib/js/char.js +++ b/lib/js/char.js @@ -4,12 +4,11 @@ let Bytes = require("./bytes.js"); function chr(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr", + Error: new Error() + }; } return n; } diff --git a/lib/js/digest.js b/lib/js/digest.js index 1630c5a8a8..5bd173cfda 100644 --- a/lib/js/digest.js +++ b/lib/js/digest.js @@ -17,12 +17,11 @@ function bytes(b) { function substring(str, ofs, len) { if (ofs < 0 || len < 0 || ofs > (str.length - len | 0)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.substring" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring", + Error: new Error() + }; } return Caml_md5.md5_string(str, ofs, len); } @@ -39,12 +38,11 @@ function char_hex(n) { function to_hex(d) { if (d.length !== 16) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.to_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.to_hex", + Error: new Error() + }; } let result = Caml_bytes.create(32); for (let i = 0; i <= 15; ++i) { @@ -57,43 +55,39 @@ function to_hex(d) { function from_hex(s) { if (s.length !== 32) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } let digit = c => { if (c >= 65) { if (c >= 97) { if (c >= 103) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } return (c - /* 'a' */97 | 0) + 10 | 0; } if (c >= 71) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } return (c - /* 'A' */65 | 0) + 10 | 0; } if (c > 57 || c < 48) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Digest.from_hex" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex", + Error: new Error() + }; } return c - /* '0' */48 | 0; }; diff --git a/lib/js/filename.js b/lib/js/filename.js index 293fb0b731..468cfb2c0f 100644 --- a/lib/js/filename.js +++ b/lib/js/filename.js @@ -123,9 +123,7 @@ try { if (exn.RE_EXN_ID === "Not_found") { temp_dir_name = "/tmp"; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -205,9 +203,7 @@ try { if (exn$1.RE_EXN_ID === "Not_found") { temp_dir_name$1 = "."; } else { - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } @@ -382,12 +378,11 @@ function concat(dirname, filename) { function chop_suffix(name, suff) { let n = name.length - suff.length | 0; if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_suffix" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix", + Error: new Error() + }; } return $$String.sub(name, 0, n); } @@ -430,12 +425,11 @@ function extension(name) { function chop_extension(name) { let l = extension_len(name); if (l === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Filename.chop_extension" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension", + Error: new Error() + }; } return $$String.sub(name, 0, name.length - l | 0); } diff --git a/lib/js/genlex.js b/lib/js/genlex.js index 0b989249f2..658e6da2a3 100644 --- a/lib/js/genlex.js +++ b/lib/js/genlex.js @@ -58,9 +58,7 @@ function make_lexer(keywords) { _0: id }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let keyword_or_error = c => { @@ -70,16 +68,13 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === "Not_found") { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "Illegal character " + s - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "Illegal character " + s, + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let next_token = strm__ => { @@ -118,26 +113,22 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } let match = Stream.peek(strm__); if (match !== undefined) { if (match !== 39) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); return { @@ -145,12 +136,11 @@ function make_lexer(keywords) { _0: c$1 }; } - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; case 40 : Stream.junk(strm__); let match$1 = Stream.peek(strm__); @@ -473,16 +463,13 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } store(c$1); continue; @@ -490,11 +477,10 @@ function make_lexer(keywords) { Stream.junk(strm__); return get_string(); } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; }; }; let char = strm__ => { @@ -510,23 +496,19 @@ function make_lexer(keywords) { } catch (raw_exn) { let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; } }; let escape = strm__ => { @@ -553,50 +535,45 @@ function make_lexer(keywords) { let c2 = Stream.peek(strm__); if (c2 !== undefined) { if (c2 > 57 || c2 < 48) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); let c3 = Stream.peek(strm__); if (c3 !== undefined) { if (c3 > 57 || c3 < 48) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); return Char.chr((Math.imul(c1 - 48 | 0, 100) + Math.imul(c2 - 48 | 0, 10) | 0) + (c3 - 48 | 0) | 0); } - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); - } - throw new Error(Stream.$$Error, { - cause: { + throw { RE_EXN_ID: Stream.$$Error, - _1: "" - } - }); + _1: "", + Error: new Error() + }; + } + throw { + RE_EXN_ID: Stream.$$Error, + _1: "", + Error: new Error() + }; } Stream.junk(strm__); return c1; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; } }; let comment = strm__ => { @@ -617,11 +594,10 @@ function make_lexer(keywords) { return comment(strm__); } } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; case 42 : Stream.junk(strm__); while (true) { @@ -638,22 +614,20 @@ function make_lexer(keywords) { Stream.junk(strm__); return; } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; }; default: Stream.junk(strm__); continue; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw { + RE_EXN_ID: Stream.Failure, + Error: new Error() + }; } }; }; diff --git a/lib/js/hashtbl.js b/lib/js/hashtbl.js index b22fa9064a..2d2fe16921 100644 --- a/lib/js/hashtbl.js +++ b/lib/js/hashtbl.js @@ -109,16 +109,15 @@ function copy_bucketlist(param) { next: next }; if (typeof prec !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "hashtbl.res", - 110, - 19 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "hashtbl.res", + 110, + 19 + ], + Error: new Error() + }; } prec.next = r; _param = next; @@ -252,11 +251,10 @@ function remove(h, key) { function find(h, key) { let match = Caml_array.get(h.data, key_index(h, key)); if (typeof match !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k1 = match.key; let d1 = match.data; @@ -265,11 +263,10 @@ function find(h, key) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k2 = next1.key; let d2 = next1.data; @@ -278,11 +275,10 @@ function find(h, key) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k3 = next2.key; let d3 = next2.data; @@ -294,11 +290,10 @@ function find(h, key) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k = param.key; let data = param.data; @@ -468,14 +463,10 @@ function iter(f, h) { } } catch (exn) { if (old_trav) { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } flip_ongoing_traversal(h); - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -525,14 +516,10 @@ function filter_map_inplace(f, h) { return; } catch (exn) { if (old_trav) { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } flip_ongoing_traversal(h); - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -568,14 +555,10 @@ function fold(f, h, init) { return accu; } catch (exn) { if (old_trav) { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } flip_ongoing_traversal(h); - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -654,11 +637,10 @@ function MakeSeeded(H) { let find = (h, key) => { let match = Caml_array.get(h.data, key_index(h, key)); if (typeof match !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k1 = match.key; let d1 = match.data; @@ -667,11 +649,10 @@ function MakeSeeded(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k2 = next1.key; let d2 = next1.data; @@ -680,11 +661,10 @@ function MakeSeeded(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k3 = next2.key; let d3 = next2.data; @@ -696,11 +676,10 @@ function MakeSeeded(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k = param.key; let data = param.data; @@ -900,11 +879,10 @@ function Make(H) { let find = (h, key) => { let match = Caml_array.get(h.data, key_index(h, key)); if (typeof match !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k1 = match.key; let d1 = match.data; @@ -913,11 +891,10 @@ function Make(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k2 = next1.key; let d2 = next1.data; @@ -926,11 +903,10 @@ function Make(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k3 = next2.key; let d3 = next2.data; @@ -942,11 +918,10 @@ function Make(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let k = param.key; let data = param.data; diff --git a/lib/js/int32.js b/lib/js/int32.js index 00883d1909..2493b20d95 100644 --- a/lib/js/int32.js +++ b/lib/js/int32.js @@ -36,9 +36,7 @@ function of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/int64.js b/lib/js/int64.js index b46cab5118..c6423d62e4 100644 --- a/lib/js/int64.js +++ b/lib/js/int64.js @@ -29,9 +29,7 @@ function of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/js_exn.js b/lib/js/js_exn.js index 706c4b6181..34b90db044 100644 --- a/lib/js/js_exn.js +++ b/lib/js/js_exn.js @@ -2,45 +2,31 @@ function raiseError(str) { - throw new Error(new Error(str).RE_EXN_ID, { - cause: new Error(str) - }); + throw new Error(str); } function raiseEvalError(str) { - throw new Error(new EvalError(str).RE_EXN_ID, { - cause: new EvalError(str) - }); + throw new EvalError(str); } function raiseRangeError(str) { - throw new Error(new RangeError(str).RE_EXN_ID, { - cause: new RangeError(str) - }); + throw new RangeError(str); } function raiseReferenceError(str) { - throw new Error(new ReferenceError(str).RE_EXN_ID, { - cause: new ReferenceError(str) - }); + throw new ReferenceError(str); } function raiseSyntaxError(str) { - throw new Error(new SyntaxError(str).RE_EXN_ID, { - cause: new SyntaxError(str) - }); + throw new SyntaxError(str); } function raiseTypeError(str) { - throw new Error(new TypeError(str).RE_EXN_ID, { - cause: new TypeError(str) - }); + throw new TypeError(str); } function raiseUriError(str) { - throw new Error(new URIError(str).RE_EXN_ID, { - cause: new URIError(str) - }); + throw new URIError(str); } let $$Error$1 = "JsError"; diff --git a/lib/js/js_null.js b/lib/js/js_null.js index 7d8ddcb6e1..682a2a31a5 100644 --- a/lib/js/js_null.js +++ b/lib/js/js_null.js @@ -10,9 +10,7 @@ function getExn(f) { if (f !== null) { return f; } - throw new Error(new Error("Js.Null.getExn").RE_EXN_ID, { - cause: new Error("Js.Null.getExn") - }); + throw new Error("Js.Null.getExn"); } function bind(x, f) { diff --git a/lib/js/js_option.js b/lib/js/js_option.js index 0b876c2b9a..5a513afd29 100644 --- a/lib/js/js_option.js +++ b/lib/js/js_option.js @@ -26,9 +26,7 @@ function getExn(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error(new Error("getExn").RE_EXN_ID, { - cause: new Error("getExn") - }); + throw new Error("getExn"); } function equal(eq, a, b) { diff --git a/lib/js/js_undefined.js b/lib/js/js_undefined.js index 567ce8fec5..f67e1ec960 100644 --- a/lib/js/js_undefined.js +++ b/lib/js/js_undefined.js @@ -14,9 +14,7 @@ function getExn(f) { if (f !== undefined) { return f; } - throw new Error(new Error("Js.Undefined.getExn").RE_EXN_ID, { - cause: new Error("Js.Undefined.getExn") - }); + throw new Error("Js.Undefined.getExn"); } function bind(x, f) { diff --git a/lib/js/lexing.js b/lib/js/lexing.js index 8b7d2f0f20..01083fc59f 100644 --- a/lib/js/lexing.js +++ b/lib/js/lexing.js @@ -54,12 +54,11 @@ function from_function(f) { } else { let newlen = (x.lex_buffer.length << 1); if (((x.lex_buffer_len - x.lex_start_pos | 0) + n | 0) > newlen) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Lexing.lex_refill: cannot grow buffer" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "Lexing.lex_refill: cannot grow buffer", + Error: new Error() + }; } let newbuf = Caml_bytes.create(newlen); Bytes.blit(x.lex_buffer, x.lex_start_pos, newbuf, 0, x.lex_buffer_len - x.lex_start_pos | 0); diff --git a/lib/js/list.js b/lib/js/list.js index cebd113d2d..967d6dbb66 100644 --- a/lib/js/list.js +++ b/lib/js/list.js @@ -30,34 +30,31 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "hd", + Error: new Error() + }; } function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "tl", + Error: new Error() + }; } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -72,23 +69,21 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "nth", + Error: new Error() + }; }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -156,12 +151,11 @@ function init_aux(i, n, f) { function init(len, f) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } if (len > 10000) { return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); @@ -280,22 +274,20 @@ function map2(f, l1, l2) { tl: map2(f, l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } function rev_map2(f, l1, l2) { @@ -316,20 +308,18 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } return accu; }; @@ -346,22 +336,20 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; }; } @@ -377,20 +365,18 @@ function fold_left2(f, _accu, _l1, _l2) { _accu = f(accu, l1.hd, l2.hd); continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } return accu; }; @@ -401,20 +387,18 @@ function fold_right2(f, l1, l2, accu) { if (l2) { return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } return accu; } @@ -460,22 +444,20 @@ function for_all2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; }; } @@ -492,22 +474,20 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; }; } @@ -550,11 +530,10 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -584,11 +563,10 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -678,11 +656,10 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -790,22 +767,20 @@ function combine(l1, l2) { tl: combine(l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } function merge(cmp, l1, l2) { @@ -842,16 +817,15 @@ function chop(_k, _l) { _k = k - 1 | 0; continue; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "list.res", - 420, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "list.res", + 420, + 11 + ], + Error: new Error() + }; }; } diff --git a/lib/js/listLabels.js b/lib/js/listLabels.js index b026ab1ad4..efb24d4ab4 100644 --- a/lib/js/listLabels.js +++ b/lib/js/listLabels.js @@ -30,34 +30,31 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "hd", + Error: new Error() + }; } function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "tl", + Error: new Error() + }; } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -72,23 +69,21 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } - }); + throw { + RE_EXN_ID: "Failure", + _1: "nth", + Error: new Error() + }; }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.nth", + Error: new Error() + }; } let _l = l; let _n = n; @@ -156,12 +151,11 @@ function init_aux(i, n, f) { function init(len, f) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.init" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.init", + Error: new Error() + }; } if (len > 10000) { return rev_append(init_tailrec_aux(/* [] */0, 0, len, f), /* [] */0); @@ -280,22 +274,20 @@ function map2(f, l1, l2) { tl: map2(f, l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.map2", + Error: new Error() + }; } function rev_map2(f, l1, l2) { @@ -316,20 +308,18 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2", + Error: new Error() + }; } return accu; }; @@ -346,22 +336,20 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2", + Error: new Error() + }; }; } @@ -377,20 +365,18 @@ function fold_left2(f, _accu, _l1, _l2) { _accu = f(accu, l1.hd, l2.hd); continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2", + Error: new Error() + }; } return accu; }; @@ -401,20 +387,18 @@ function fold_right2(f, l1, l2, accu) { if (l2) { return f(l1.hd, l2.hd, fold_right2(f, l1.tl, l2.tl, accu)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2", + Error: new Error() + }; } return accu; } @@ -460,22 +444,20 @@ function for_all2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2", + Error: new Error() + }; }; } @@ -492,22 +474,20 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2", + Error: new Error() + }; }; } @@ -550,11 +530,10 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -584,11 +563,10 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -678,11 +656,10 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; }; } @@ -790,22 +767,20 @@ function combine(l1, l2) { tl: combine(l1.tl, l2.tl) }; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "List.combine", + Error: new Error() + }; } function merge(cmp, l1, l2) { @@ -842,16 +817,15 @@ function chop(_k, _l) { _k = k - 1 | 0; continue; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "listLabels.res", - 420, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "listLabels.res", + 420, + 11 + ], + Error: new Error() + }; }; } diff --git a/lib/js/map.js b/lib/js/map.js index 3588ee0024..33fa37ef6e 100644 --- a/lib/js/map.js +++ b/lib/js/map.js @@ -37,12 +37,11 @@ function Make(funarg) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -54,12 +53,11 @@ function Make(funarg) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -72,12 +70,11 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -89,12 +86,11 @@ function Make(funarg) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = param => { if (typeof param !== "object") { @@ -152,11 +148,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = funarg.compare(x, param.v); if (c === 0) { @@ -170,11 +165,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -246,11 +240,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -350,11 +343,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -388,11 +380,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -424,12 +415,11 @@ function Make(funarg) { }; let remove_min_binding = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -717,16 +707,15 @@ function Make(funarg) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); diff --git a/lib/js/mapLabels.js b/lib/js/mapLabels.js index 4094b6e60e..8b5b3c56fd 100644 --- a/lib/js/mapLabels.js +++ b/lib/js/mapLabels.js @@ -37,12 +37,11 @@ function Make(Ord) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -54,12 +53,11 @@ function Make(Ord) { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -72,12 +70,11 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -89,12 +86,11 @@ function Make(Ord) { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = param => { if (typeof param !== "object") { @@ -152,11 +148,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = Ord.compare(x, param.v); if (c === 0) { @@ -192,11 +187,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -268,11 +262,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -350,11 +343,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -388,11 +380,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -424,12 +415,11 @@ function Make(Ord) { }; let remove_min_binding = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -717,16 +707,15 @@ function Make(Ord) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); diff --git a/lib/js/moreLabels.js b/lib/js/moreLabels.js index fdbe98c04b..1afa76adb7 100644 --- a/lib/js/moreLabels.js +++ b/lib/js/moreLabels.js @@ -67,12 +67,11 @@ let $$Map = { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let lr = l.r; let ld = l.d; @@ -84,12 +83,11 @@ let $$Map = { if (typeof lr === "object") { return create(create(ll, lv, ld, lr.l), lr.v, lr.d, create(lr.r, x, d, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -102,12 +100,11 @@ let $$Map = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; } let rr = r.r; let rd = r.d; @@ -119,12 +116,11 @@ let $$Map = { if (typeof rl === "object") { return create(create(l, x, d, rl.l), rl.v, rl.d, create(rl.r, rv, rd, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal", + Error: new Error() + }; }; let is_empty = param => { if (typeof param !== "object") { @@ -182,11 +178,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let c = funarg.compare(x, param.v); if (c === 0) { @@ -222,11 +217,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -298,11 +292,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -380,11 +373,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -418,11 +410,10 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -454,12 +445,11 @@ let $$Map = { }; let remove_min_binding = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -747,16 +737,15 @@ let $$Map = { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ], + Error: new Error() + }; } let v2 = s2.v; let match$1 = split(v2, s1); @@ -1011,12 +1000,11 @@ let $$Set = { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -1027,12 +1015,11 @@ let $$Set = { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -1044,12 +1031,11 @@ let $$Set = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -1060,12 +1046,11 @@ let $$Set = { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, param) => { if (typeof param !== "object") { @@ -1141,11 +1126,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1173,11 +1157,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -1203,12 +1186,11 @@ let $$Set = { }; let remove_min_elt = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -1598,11 +1580,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = funarg.compare(x, v); @@ -1634,11 +1615,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1700,11 +1680,10 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -1874,16 +1853,15 @@ let $$Set = { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l), l)[0]; }; diff --git a/lib/js/parsing.js b/lib/js/parsing.js index b4a3eef011..060a22154d 100644 --- a/lib/js/parsing.js +++ b/lib/js/parsing.js @@ -85,11 +85,10 @@ function yyparse(tables, start, lexer, lexbuf) { _cmd = "Token_read"; continue; case "Raise_parse_error" : - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw { + RE_EXN_ID: Parse_error, + Error: new Error() + }; case "Grow_stacks_1" : grow_stacks(); _arg = undefined; @@ -115,9 +114,7 @@ function yyparse(tables, start, lexer, lexbuf) { undefined ]; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } _arg = match$1[1]; @@ -150,9 +147,7 @@ function yyparse(tables, start, lexer, lexbuf) { return Caml_array.get(tables.transl_const, tok) === curr_char; } }; - throw new Error(exn$1.RE_EXN_ID, { - cause: exn$1 - }); + throw exn$1; } } diff --git a/lib/js/pervasives.js b/lib/js/pervasives.js index 445c238f4b..e565627692 100644 --- a/lib/js/pervasives.js +++ b/lib/js/pervasives.js @@ -7,21 +7,19 @@ let Caml_exceptions = require("./caml_exceptions.js"); let Caml_js_exceptions = require("./caml_js_exceptions.js"); function failwith(s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } - }); + throw { + RE_EXN_ID: "Failure", + _1: s, + Error: new Error() + }; } function invalid_arg(s) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } let Exit = /* @__PURE__ */Caml_exceptions.create("Pervasives.Exit"); @@ -58,12 +56,11 @@ function classify_float(x) { function char_of_int(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "char_of_int" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "char_of_int", + Error: new Error() + }; } return n; } @@ -83,12 +80,11 @@ function bool_of_string(param) { case "true" : return true; default: - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "bool_of_string" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "bool_of_string", + Error: new Error() + }; } } @@ -111,9 +107,7 @@ function int_of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -153,9 +147,7 @@ function float_of_string_opt(s) { if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/queue.js b/lib/js/queue.js index eaf58a010c..a6a5df8fa2 100644 --- a/lib/js/queue.js +++ b/lib/js/queue.js @@ -41,21 +41,19 @@ function peek(q) { if (typeof match === "object") { return match.content; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } function take(q) { let match = q.first; if (typeof match !== "object") { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } let content = match.content; let next = match.next; diff --git a/lib/js/random.js b/lib/js/random.js index 0b844d4e69..5202c9f031 100644 --- a/lib/js/random.js +++ b/lib/js/random.js @@ -71,12 +71,11 @@ function bits(s) { function int(s, bound) { if (bound > 1073741823 || bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int", + Error: new Error() + }; } while (true) { let r = bits(s); @@ -90,12 +89,11 @@ function int(s, bound) { function int32(s, bound) { if (bound <= 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int32" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32", + Error: new Error() + }; } while (true) { let b1 = bits(s); @@ -111,12 +109,11 @@ function int32(s, bound) { function int64(s, bound) { if (Caml.i64_le(bound, Caml_int64.zero)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Random.int64" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64", + Error: new Error() + }; } while (true) { let b1 = Caml_int64.of_int32(bits(s)); diff --git a/lib/js/runtime_deriving.js b/lib/js/runtime_deriving.js index 5b1bc5652f..0f0f4175e3 100644 --- a/lib/js/runtime_deriving.js +++ b/lib/js/runtime_deriving.js @@ -3,11 +3,10 @@ function raiseWhenNotFound(x) { if (x == null) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } return x; } diff --git a/lib/js/set.js b/lib/js/set.js index 3b5ca118c9..38b2616ce9 100644 --- a/lib/js/set.js +++ b/lib/js/set.js @@ -31,12 +31,11 @@ function Make(funarg) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -47,12 +46,11 @@ function Make(funarg) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -64,12 +62,11 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -80,12 +77,11 @@ function Make(funarg) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, param) => { if (typeof param !== "object") { @@ -161,11 +157,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -193,11 +188,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -223,12 +217,11 @@ function Make(funarg) { }; let remove_min_elt = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -616,11 +609,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = funarg.compare(x, v); @@ -635,11 +627,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -699,11 +690,10 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -906,16 +896,15 @@ function Make(funarg) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l$1), l$1)[0]; } else { diff --git a/lib/js/setLabels.js b/lib/js/setLabels.js index 85c913e920..2b2af67dce 100644 --- a/lib/js/setLabels.js +++ b/lib/js/setLabels.js @@ -31,12 +31,11 @@ function Make(Ord) { hr = typeof r !== "object" ? 0 : r.h; if (hl > (hr + 2 | 0)) { if (typeof l !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let lr = l.r; let lv = l.v; @@ -47,12 +46,11 @@ function Make(Ord) { if (typeof lr === "object") { return create(create(ll, lv, lr.l), lr.v, create(lr.r, v, r)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } if (hr <= (hl + 2 | 0)) { return { @@ -64,12 +62,11 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; } let rr = r.r; let rv = r.v; @@ -80,12 +77,11 @@ function Make(Ord) { if (typeof rl === "object") { return create(create(l, v, rl.l), rl.v, create(rl.r, rv, rr)); } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal", + Error: new Error() + }; }; let add = (x, param) => { if (typeof param !== "object") { @@ -161,11 +157,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -193,11 +188,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let r = param.r; if (typeof r !== "object") { @@ -223,12 +217,11 @@ function Make(Ord) { }; let remove_min_elt = param => { if (typeof param !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.remove_min_elt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt", + Error: new Error() + }; } let l = param.l; if (typeof l !== "object") { @@ -618,11 +611,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; let c = Ord.compare(x, v); @@ -654,11 +646,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -720,11 +711,10 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } let v = param.v; if (f(v)) { @@ -894,16 +884,15 @@ function Make(Ord) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ], + Error: new Error() + }; }; return sub(List.length(l), l)[0]; }; diff --git a/lib/js/sort.js b/lib/js/sort.js index d4556f5ccd..f065720f4d 100644 --- a/lib/js/sort.js +++ b/lib/js/sort.js @@ -114,12 +114,11 @@ function array(cmp, arr) { let i = lo + 1 | 0; let j = hi - 1 | 0; if (!cmp(pivot, arr[hi]) || !cmp(arr[lo], pivot)) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Sort.array" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "Sort.array", + Error: new Error() + }; } while (i < j) { while (!cmp(pivot, arr[i])) { diff --git a/lib/js/stack.js b/lib/js/stack.js index e90720d44c..8e9b67f45e 100644 --- a/lib/js/stack.js +++ b/lib/js/stack.js @@ -39,11 +39,10 @@ function pop(s) { s.len = s.len - 1 | 0; return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } function top(s) { @@ -51,11 +50,10 @@ function top(s) { if (match) { return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw { + RE_EXN_ID: Empty, + Error: new Error() + }; } function is_empty(s) { diff --git a/lib/js/stream.js b/lib/js/stream.js index ac7705230d..d4c089ee7b 100644 --- a/lib/js/stream.js +++ b/lib/js/stream.js @@ -54,16 +54,15 @@ function get_data(count, _d) { } }; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stream.res", - 53, - 13 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 53, + 13 + ], + Error: new Error() + }; case "Slazy" : _d = CamlinternalLazy.force(d._0); continue; @@ -116,16 +115,15 @@ function peek_data(s) { s.data = d; return Caml_option.some(d._0); } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stream.res", - 83, - 13 - ] - } - }); + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 83, + 13 + ], + Error: new Error() + }; case "Slazy" : s.data = CamlinternalLazy.force(f._0); continue; @@ -234,11 +232,10 @@ function next(s) { junk(s); return Caml_option.valFromOption(a); } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw { + RE_EXN_ID: Failure, + Error: new Error() + }; } function empty(s) { @@ -246,11 +243,10 @@ function empty(s) { if (match === undefined) { return; } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw { + RE_EXN_ID: Failure, + Error: new Error() + }; } function iter(f, strm) { diff --git a/lib/js/string.js b/lib/js/string.js index 7a0052196d..4da913526c 100644 --- a/lib/js/string.js +++ b/lib/js/string.js @@ -90,11 +90,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -129,12 +128,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -142,12 +140,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -156,11 +153,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -176,12 +172,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -206,12 +201,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -219,12 +213,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -234,9 +227,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -246,12 +237,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -261,9 +251,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/stringLabels.js b/lib/js/stringLabels.js index 40f76f7f90..9e9861db12 100644 --- a/lib/js/stringLabels.js +++ b/lib/js/stringLabels.js @@ -92,11 +92,10 @@ function index_rec(s, lim, _i, c) { while (true) { let i = _i; if (i >= lim) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -131,12 +130,11 @@ function index_opt(s, c) { function index_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from / Bytes.index_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from", + Error: new Error() + }; } return index_rec(s, l, i, c); } @@ -144,12 +142,11 @@ function index_from(s, i, c) { function index_from_opt(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.index_from_opt / Bytes.index_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt", + Error: new Error() + }; } return index_rec_opt(s, l, i, c); } @@ -158,11 +155,10 @@ function rindex_rec(s, _i, c) { while (true) { let i = _i; if (i < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; } if (s.codePointAt(i) === c) { return i; @@ -178,12 +174,11 @@ function rindex(s, c) { function rindex_from(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from / Bytes.rindex_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from", + Error: new Error() + }; } return rindex_rec(s, i, c); } @@ -208,12 +203,11 @@ function rindex_opt(s, c) { function rindex_from_opt(s, i, c) { if (i < -1 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rindex_from_opt / Bytes.rindex_from_opt" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt", + Error: new Error() + }; } return rindex_rec_opt(s, i, c); } @@ -221,12 +215,11 @@ function rindex_from_opt(s, i, c) { function contains_from(s, i, c) { let l = s.length; if (i < 0 || i > l) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.contains_from / Bytes.contains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from", + Error: new Error() + }; } try { index_rec(s, l, i, c); @@ -236,9 +229,7 @@ function contains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -248,12 +239,11 @@ function contains(s, c) { function rcontains_from(s, i, c) { if (i < 0 || i >= s.length) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.rcontains_from / Bytes.rcontains_from" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from", + Error: new Error() + }; } try { rindex_rec(s, i, c); @@ -263,9 +253,7 @@ function rcontains_from(s, i, c) { if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } diff --git a/lib/js/uchar.js b/lib/js/uchar.js index 43a6f0349e..afb17c438f 100644 --- a/lib/js/uchar.js +++ b/lib/js/uchar.js @@ -16,12 +16,11 @@ function succ(u) { return 57344; } if (u === 1114111) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+10FFFF has no successor" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor", + Error: new Error() + }; } return u + 1 | 0; } @@ -31,12 +30,11 @@ function pred(u) { return 55295; } if (u === 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "U+0000 has no predecessor" - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor", + Error: new Error() + }; } return u - 1 | 0; } @@ -56,12 +54,11 @@ function of_int(i) { return i; } let s = err_not_sv(i); - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } function is_char(u) { @@ -77,12 +74,11 @@ function to_char(u) { return u; } let s = err_not_latin1(u); - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } - }); + throw { + RE_EXN_ID: "Invalid_argument", + _1: s, + Error: new Error() + }; } function unsafe_to_char(prim) {