diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a50b0d335..5a1ac31ed5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Allow coercing polyvariants to variants when we can guarantee that the runtime representation matches. https://github.com/rescript-lang/rescript-compiler/pull/6981 - Add new dict literal syntax (`dict{"foo": "bar"}`). https://github.com/rescript-lang/rescript-compiler/pull/6774 +- Use `RescriptError` for runtime representation of exceptions and fix regression with not being able to throw raw Js values. https://github.com/rescript-lang/rescript-compiler/pull/6979 #### :nail_care: Polish diff --git a/jscomp/core/js_block_runtime.ml b/jscomp/core/js_block_runtime.ml index 8d80405ccd..47b7dea362 100644 --- a/jscomp/core/js_block_runtime.ml +++ b/jscomp/core/js_block_runtime.ml @@ -26,8 +26,13 @@ let option_id = Ident.create_persistent Js_runtime_modules.option let curry_id = Ident.create_persistent Js_runtime_modules.curry +let caml_js_exceptions_id = Ident.create_persistent Js_runtime_modules.caml_js_exceptions + +(* This function is responsible for checking the expressions used in the file, + and listing the additional runtime dependencies it requires *) let check_additional_id (x : J.expression) : Ident.t option = match x.expression_desc with | Optional_block (_, false) -> Some option_id | Call (_, _, { arity = NA }) -> Some curry_id + | Caml_block (el, _, _, ((Blk_extension { is_exception = true } | Blk_record_ext { is_exception = true }))) -> Some caml_js_exceptions_id | _ -> None diff --git a/jscomp/core/js_dump.ml b/jscomp/core/js_dump.ml index 44fdebef6b..51ec023277 100644 --- a/jscomp/core/js_dump.ml +++ b/jscomp/core/js_dump.ml @@ -97,43 +97,29 @@ 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) +let exn_block_as_obj ~(is_exception : bool) (el : J.expression list) (ext : J.tag_info) : J.expression = let field_name = match ext with - | Blk_extension -> ( + | Blk_extension _ -> ( fun i -> match i with 0 -> Literals.exception_id | i -> "_" ^ string_of_int i) | Blk_record_ext { fields = ss } -> ( fun i -> match i with 0 -> Literals.exception_id | i -> ss.(i - 1)) | _ -> assert false in - let cause = + let extension = { 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; - } + if is_exception then + match el with + | [extension_id] -> E.runtime_call Js_runtime_modules.caml_js_exceptions "internalMakeExn" [extension_id] + | _ -> E.runtime_call Js_runtime_modules.caml_js_exceptions "internalFromExtension" [extension] + else extension let rec iter_lst cxt (f : P.t) ls element inter = match ls with @@ -170,7 +156,7 @@ let exp_need_paren (e : J.expression) = ( _, _, _, - ( Blk_record _ | Blk_module _ | Blk_poly_var _ | Blk_extension + ( Blk_record _ | Blk_module _ | Blk_poly_var _ | Blk_extension _ | Blk_record_ext _ | Blk_record_inlined _ | Blk_constructor _ ) ) | Object _ -> true @@ -774,8 +760,8 @@ and expression_desc cxt ~(level : int) f x : cxt = (Lit Literals.polyvar_value, value); ]) | _ -> assert false) - | Caml_block (el, _, _, ((Blk_extension | Blk_record_ext _) as ext)) -> - expression cxt ~level f (exn_block_as_obj ~stack:false el ext) + | Caml_block (el, _, _, ((Blk_extension { is_exception } | Blk_record_ext { is_exception}) as ext)) -> + expression cxt ~level f (exn_block_as_obj ~is_exception el ext) | Caml_block (el, _, tag, Blk_record_inlined p) -> let untagged = Ast_untagged_variants.process_untagged p.attrs in let objs = @@ -1234,12 +1220,6 @@ and statement_desc top cxt f (s : J.statement_desc) : cxt = P.newline f; statements false cxt f def)) | Throw e -> - 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 } - in P.string f L.throw; P.space f; P.group f 0 (fun _ -> diff --git a/jscomp/core/js_exp_make.ml b/jscomp/core/js_exp_make.ml index ebbd80d281..09127423b3 100644 --- a/jscomp/core/js_exp_make.ml +++ b/jscomp/core/js_exp_make.ml @@ -250,7 +250,7 @@ let dummy_obj ?comment (info : Lam_tag_info.t) : t = *) match info with | Blk_record _ | Blk_module _ | Blk_constructor _ | Blk_record_inlined _ - | Blk_poly_var _ | Blk_extension | Blk_record_ext _ -> + | Blk_poly_var _ | Blk_extension _ | Blk_record_ext _ -> { comment; expression_desc = Object [] } | Blk_tuple | Blk_module_export _ -> { comment; expression_desc = Array ([], Mutable) } diff --git a/jscomp/core/lam_compile_primitive.ml b/jscomp/core/lam_compile_primitive.ml index 6cc0d9c816..865a56cfe4 100644 --- a/jscomp/core/lam_compile_primitive.ml +++ b/jscomp/core/lam_compile_primitive.ml @@ -79,7 +79,7 @@ let translate output_prefix loc (cxt : Lam_compile_context.t) | Pcreate_extension s -> E.make_exception s | Pwrap_exn -> E.runtime_call Js_runtime_modules.caml_js_exceptions - "internalToOCamlException" args + "internalAnyToExn" args | Praw_js_code { code; code_info } -> E.raw_js_code code_info code (* FIXME: save one allocation trim can not be done before syntax checking diff --git a/jscomp/core/lam_constant_convert.ml b/jscomp/core/lam_constant_convert.ml index 91e2201a1d..7493a3ef80 100644 --- a/jscomp/core/lam_constant_convert.ml +++ b/jscomp/core/lam_constant_convert.ml @@ -69,7 +69,7 @@ let rec convert_constant (const : Lambda.structured_constant) : Lam_constant.t = Const_some (convert_constant (Ext_list.singleton_exn xs)) | Blk_some -> Const_some (convert_constant (Ext_list.singleton_exn xs)) | Blk_constructor _ | Blk_tuple | Blk_record _ | Blk_module _ - | Blk_module_export _ | Blk_extension | Blk_record_inlined _ + | Blk_module_export _ | Blk_extension _ | Blk_record_inlined _ | Blk_record_ext _ -> Const_block (tag, t, Ext_list.map xs convert_constant) | Blk_poly_var s -> ( diff --git a/jscomp/core/lam_convert.ml b/jscomp/core/lam_convert.ml index 442dfe4ab1..f4b45bf858 100644 --- a/jscomp/core/lam_convert.ml +++ b/jscomp/core/lam_convert.ml @@ -179,7 +179,7 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t = | Blk_some_not_nested -> prim ~primitive:Psome_not_nest ~args loc | Blk_some -> prim ~primitive:Psome ~args loc | Blk_constructor _ | Blk_tuple | Blk_record _ | Blk_record_inlined _ - | Blk_module _ | Blk_module_export _ | Blk_extension | Blk_record_ext _ -> + | Blk_module _ | Blk_module_export _ | Blk_extension _ | Blk_record_ext _ -> prim ~primitive:(Pmakeblock (tag, info, mutable_flag)) ~args loc | Blk_poly_var s -> ( match args with diff --git a/jscomp/ml/ctype.ml b/jscomp/ml/ctype.ml index 950a1a598f..566f076d11 100644 --- a/jscomp/ml/ctype.ml +++ b/jscomp/ml/ctype.ml @@ -3674,7 +3674,7 @@ let rec subtype_rec env trace t1 t2 cstrs = true (* handled in the fields checks *) | Record_unboxed b1, Record_unboxed b2 -> b1 = b2 | Record_inlined _, Record_inlined _ -> repr1 = repr2 - | Record_extension, Record_extension -> true + | Record_extension b1, Record_extension b2 -> b1.is_exception = b2.is_exception | _ -> false in if same_repr then let violation, tl1, tl2 = Record_coercion.check_record_fields ~repr1 ~repr2 fields1 fields2 in diff --git a/jscomp/ml/datarepr.ml b/jscomp/ml/datarepr.ml index 227fb63d24..0f17ba984a 100644 --- a/jscomp/ml/datarepr.ml +++ b/jscomp/ml/datarepr.ml @@ -194,14 +194,14 @@ let extension_descr path_ext ext = in let existentials, cstr_args, cstr_inlined = constructor_args ext.ext_private ext.ext_args ext.ext_ret_type - path_ext Record_extension + path_ext (Record_extension { is_exception = ext.ext_is_exception }) in { cstr_name = Path.last path_ext; cstr_res = ty_res; cstr_existentials = existentials; cstr_args; cstr_arity = List.length cstr_args; - cstr_tag = Cstr_extension(path_ext); + cstr_tag = Cstr_extension(path_ext, ext.ext_is_exception); cstr_consts = -1; cstr_nonconsts = -1; cstr_private = ext.ext_private; diff --git a/jscomp/ml/env.ml b/jscomp/ml/env.ml index 1f34347025..bc316c536a 100644 --- a/jscomp/ml/env.ml +++ b/jscomp/ml/env.ml @@ -549,7 +549,7 @@ let is_ident = function | Pdot _ | Papply _ -> false let is_local_ext = function - | {cstr_tag = Cstr_extension(p)} -> is_ident p + | {cstr_tag = Cstr_extension(p, _)} -> is_ident p | _ -> false let diff env1 env2 = diff --git a/jscomp/ml/lambda.ml b/jscomp/ml/lambda.ml index 8b7489402f..98638a2130 100644 --- a/jscomp/ml/lambda.ml +++ b/jscomp/ml/lambda.ml @@ -47,11 +47,14 @@ type tag_info = | Blk_record of {fields : string array; mutable_flag : Asttypes.mutable_flag; record_repr : record_repr} | Blk_module of string list | Blk_module_export of Ident.t list - - | Blk_extension + | Blk_extension of { + is_exception: bool; } | Blk_some | Blk_some_not_nested (* ['a option] where ['a] can not inhabit a non-like value *) - | Blk_record_ext of { fields : string array; mutable_flag : Asttypes.mutable_flag} + | Blk_record_ext of { + fields: string array; + mutable_flag: Asttypes.mutable_flag; + is_exception: bool; } | Blk_lazy_general let tag_of_tag_info (tag : tag_info ) = @@ -63,7 +66,7 @@ let tag_of_tag_info (tag : tag_info ) = | Blk_record _ | Blk_module _ | Blk_module_export _ - | Blk_extension + | Blk_extension _ | Blk_some (* tag not make sense *) | Blk_some_not_nested (* tag not make sense *) | Blk_lazy_general (* tag not make sense 248 *) @@ -81,7 +84,7 @@ let mutable_flag_of_tag_info (tag : tag_info) = | Blk_poly_var _ | Blk_module _ | Blk_module_export _ - | Blk_extension + | Blk_extension _ | Blk_some_not_nested | Blk_some -> Immutable @@ -110,14 +113,14 @@ let blk_record (fields : (label * _) array) mut record_repr = { fields = all_labels_info; mutable_flag = mut; record_repr } -let blk_record_ext fields mutable_flag = +let blk_record_ext fields mutable_flag is_exception = let all_labels_info = Array.map (fun ((lbl : label), _) -> Ext_list.find_def lbl.Types.lbl_attributes find_name lbl.lbl_name) fields in - Blk_record_ext {fields = all_labels_info; mutable_flag } + Blk_record_ext {fields = all_labels_info; mutable_flag; is_exception } let blk_record_inlined fields name num_nonconst optional_labels ~tag ~attrs mutable_flag = let fields = diff --git a/jscomp/ml/lambda.mli b/jscomp/ml/lambda.mli index 87125870c5..ec91fa4e2e 100644 --- a/jscomp/ml/lambda.mli +++ b/jscomp/ml/lambda.mli @@ -46,7 +46,8 @@ type tag_info = | Blk_record of {fields : string array; mutable_flag : mutable_flag; record_repr : record_repr } | Blk_module of string list | Blk_module_export of Ident.t list - | Blk_extension + | Blk_extension of { + is_exception: bool; } (* underlying is the same as tuple, immutable block {[ exception A of int * int @@ -60,7 +61,10 @@ type tag_info = | Blk_some | Blk_some_not_nested (* ['a option] where ['a] can not inhabit a non-like value *) - | Blk_record_ext of {fields : string array; mutable_flag : mutable_flag} + | Blk_record_ext of { + fields: string array; + mutable_flag: mutable_flag; + is_exception: bool; } | Blk_lazy_general val find_name : @@ -78,6 +82,7 @@ val blk_record : val blk_record_ext : (Types.label_description* Typedtree.record_label_definition) array -> mutable_flag -> + bool -> tag_info diff --git a/jscomp/ml/matching.ml b/jscomp/ml/matching.ml index d1fe30cc50..50f2cc54c5 100644 --- a/jscomp/ml/matching.ml +++ b/jscomp/ml/matching.ml @@ -1602,7 +1602,7 @@ let make_record_matching loc all_labels def = function | Record_inlined _ -> Lprim (Pfield (lbl.lbl_pos, Lambda.fld_record_inline lbl), [arg], loc) | Record_unboxed _ -> arg - | Record_extension -> Lprim (Pfield (lbl.lbl_pos + 1, Lambda.fld_record_extension lbl), [arg], loc) + | Record_extension _ -> Lprim (Pfield (lbl.lbl_pos + 1, Lambda.fld_record_extension lbl), [arg], loc) in let str = match lbl.lbl_mut with @@ -2279,7 +2279,7 @@ let get_extension_cases tag_lambda_list = | (cstr, act) :: rem -> let nonconsts = split_rec rem in match cstr with - | Cstr_extension(path) -> ((path, act) :: nonconsts) + | Cstr_extension(path, _) -> ((path, act) :: nonconsts) | _ -> assert false in split_rec tag_lambda_list @@ -2918,7 +2918,9 @@ let partial_function loc () = let fname = Filename.basename fname in - Lprim(Praise Raise_regular, [Lprim(Pmakeblock(Blk_extension), + Lprim(Praise Raise_regular, [Lprim(Pmakeblock(Blk_extension { + is_exception = true; + }), [transl_normal_path Predef.path_match_failure; Lconst(Const_block(Blk_tuple, [Const_base(Const_string (fname, None)); diff --git a/jscomp/ml/printlambda.ml b/jscomp/ml/printlambda.ml index 4dc4e7705e..c40d0c4b1f 100644 --- a/jscomp/ml/printlambda.ml +++ b/jscomp/ml/printlambda.ml @@ -106,7 +106,7 @@ let str_of_field_info (fld_info : Lambda.field_dbg_info)= | Fld_cons -> "cons" | Fld_array -> "[||]" let print_taginfo ppf = function - | Blk_extension -> fprintf ppf "ext" + | Blk_extension _ -> fprintf ppf "ext" | Blk_record_ext {fields = ss} -> fprintf ppf "[%s]" (String.concat ";" (Array.to_list ss) ) | Blk_tuple -> fprintf ppf "tuple" | Blk_constructor {name ;num_nonconst} -> fprintf ppf "%s/%i" name num_nonconst diff --git a/jscomp/ml/printtyped.ml b/jscomp/ml/printtyped.ml index 5b514ac36e..759886c732 100644 --- a/jscomp/ml/printtyped.ml +++ b/jscomp/ml/printtyped.ml @@ -150,7 +150,7 @@ let record_representation i ppf = let open Types in function line i ppf "Record_optional_labels %s\n" (lbls |> String.concat ", ") | Record_unboxed b -> line i ppf "Record_unboxed %b\n" b | Record_inlined {tag = i} -> line i ppf "Record_inlined %d\n" i - | Record_extension -> line i ppf "Record_extension\n" + | Record_extension _ -> line i ppf "Record_extension\n" let attributes i ppf l = let i = i + 1 in diff --git a/jscomp/ml/rec_check.ml b/jscomp/ml/rec_check.ml index a31f7f555a..791f2e0b31 100644 --- a/jscomp/ml/rec_check.ml +++ b/jscomp/ml/rec_check.ml @@ -240,7 +240,7 @@ let rec expression : Env.env -> Typedtree.expression -> Use.t = | Texp_construct (_, desc, exprs) -> let access_constructor = match desc.cstr_tag with - | Cstr_extension (pth) -> Use.inspect (path env pth) + | Cstr_extension (pth, _) -> Use.inspect (path env pth) | _ -> Use.empty in let use = @@ -256,7 +256,7 @@ let rec expression : Env.env -> Typedtree.expression -> Use.t = match rep with | Record_unboxed _ -> fun x -> x | Record_float_unused -> assert false - | Record_optional_labels _ | Record_regular | Record_inlined _ | Record_extension + | Record_optional_labels _ | Record_regular | Record_inlined _ | Record_extension _ -> Use.guard in diff --git a/jscomp/ml/translcore.ml b/jscomp/ml/translcore.ml index d73468ced0..b15f40f36c 100644 --- a/jscomp/ml/translcore.ml +++ b/jscomp/ml/translcore.ml @@ -685,7 +685,7 @@ let assert_failed exp = ( Praise Raise_regular, [ Lprim - ( Pmakeblock Blk_extension, + ( Pmakeblock (Blk_extension {is_exception = true}), [ transl_normal_path Predef.path_assert_failure; Lconst @@ -905,9 +905,9 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda = in try Lconst (Const_block (tag_info, List.map extract_constant ll)) with Not_constant -> Lprim (Pmakeblock tag_info, ll, e.exp_loc)) - | Cstr_extension (path) -> + | Cstr_extension (path, is_exception) -> Lprim - ( Pmakeblock Blk_extension, + ( Pmakeblock (Blk_extension {is_exception}), transl_extension_path e.exp_env path :: ll, e.exp_loc )) | Texp_extension_constructor (_, path) -> transl_extension_path e.exp_env path @@ -943,7 +943,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda = [ targ ], e.exp_loc ) | Record_unboxed _ -> targ - | Record_extension -> + | Record_extension _ -> Lprim ( Pfield (lbl.lbl_pos + 1, Lambda.fld_record_extension lbl), @@ -958,7 +958,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda = | Record_inlined _ -> Psetfield (lbl.lbl_pos, Lambda.fld_record_inline_set lbl) | Record_unboxed _ -> assert false - | Record_extension -> + | Record_extension _ -> Psetfield (lbl.lbl_pos + 1, Lambda.fld_record_extension_set lbl) in Lprim (access, [ transl_exp arg; transl_exp newval ], e.exp_loc) @@ -1212,7 +1212,7 @@ and transl_record loc env fields repres opt_init_expr = | Record_inlined _ -> Pfield (i, Lambda.fld_record_inline lbl) | Record_unboxed _ -> assert false - | Record_extension -> + | Record_extension _ -> Pfield (i + 1, Lambda.fld_record_extension lbl) in @@ -1246,7 +1246,7 @@ and transl_record loc env fields repres opt_init_expr = cl )) | Record_unboxed _ -> Lconst (match cl with [ v ] -> v | _ -> assert false) - | Record_extension -> raise Not_constant + | Record_extension _ -> raise Not_constant with Not_constant -> ( match repres with | Record_regular -> @@ -1269,7 +1269,7 @@ and transl_record loc env fields repres opt_init_expr = loc ) | Record_unboxed _ -> ( match ll with [ v ] -> v | _ -> assert false) - | Record_extension -> + | Record_extension { is_exception } -> let path = let label, _ = fields.(0) in match label.lbl_res.desc with @@ -1278,7 +1278,7 @@ and transl_record loc env fields repres opt_init_expr = in let slot = transl_extension_path env path in Lprim - ( Pmakeblock (Lambda.blk_record_ext fields mut), + ( Pmakeblock (Lambda.blk_record_ext fields mut is_exception), slot :: ll, loc )) in @@ -1302,7 +1302,7 @@ and transl_record loc env fields repres opt_init_expr = | Record_inlined _ -> Psetfield (lbl.lbl_pos, Lambda.fld_record_inline_set lbl) | Record_unboxed _ -> assert false - | Record_extension -> + | Record_extension _ -> Psetfield (lbl.lbl_pos + 1, Lambda.fld_record_extension_set lbl) in diff --git a/jscomp/ml/typecore.ml b/jscomp/ml/typecore.ml index bdb8a137e4..506e032682 100644 --- a/jscomp/ml/typecore.ml +++ b/jscomp/ml/typecore.ml @@ -2839,7 +2839,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg=Rejected) env sexp ty } ] -> let path = match (Typetexp.find_constructor env lid.loc lid.txt).cstr_tag with - | Cstr_extension (path) -> path + | Cstr_extension (path, _) -> path | _ -> raise (Error (lid.loc, env, Not_an_extension_constructor)) in rue { diff --git a/jscomp/ml/typedecl.ml b/jscomp/ml/typedecl.ml index 2dcbb224cf..33559d788c 100644 --- a/jscomp/ml/typedecl.ml +++ b/jscomp/ml/typedecl.ml @@ -1531,7 +1531,7 @@ let transl_extension_constructor env type_path type_params end; let path = match cdescr.cstr_tag with - Cstr_extension(path) -> path + Cstr_extension (path, _) -> path | _ -> assert false in let args = @@ -1549,7 +1549,7 @@ let transl_extension_constructor env type_path type_params List.iter2 (Ctype.unify env) decl.type_params tl; let lbls = match decl.type_kind with - | Type_record (lbls, Record_extension) -> lbls + | Type_record (lbls, Record_extension _) -> lbls | _ -> assert false in Types.Cstr_record lbls diff --git a/jscomp/ml/types.ml b/jscomp/ml/types.ml index 16923025d2..8601551620 100644 --- a/jscomp/ml/types.ml +++ b/jscomp/ml/types.ml @@ -155,7 +155,8 @@ and record_representation = | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) | Record_inlined of (* Inlined record *) { tag : int ; name : string; num_nonconsts : int; optional_labels : string list; attrs: Parsetree.attributes} - | Record_extension (* Inlined record under extension *) + | Record_extension of (* Inlined record under extension *) + { is_exception : bool } | Record_optional_labels of string list (* List of optional labels *) and label_declaration = @@ -282,15 +283,15 @@ and constructor_tag = Cstr_constant of int (* Constant constructor (an int) *) | Cstr_block of int (* Regular constructor (a block) *) | Cstr_unboxed (* Constructor of an unboxed type *) - | Cstr_extension of Path.t (* Extension constructor *) + | Cstr_extension of Path.t * bool (* Extension constructor. true if is_exception *) let equal_tag t1 t2 = match (t1, t2) with | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 | Cstr_block i1, Cstr_block i2 -> i2 = i1 | Cstr_unboxed, Cstr_unboxed -> true - | Cstr_extension (path1), Cstr_extension (path2) -> - Path.same path1 path2 + | Cstr_extension (path1, is_exception1), Cstr_extension (path2, is_exception2) -> + Path.same path1 path2 && is_exception1 = is_exception2 | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false let may_equal_constr c1 c2 = match c1.cstr_tag,c2.cstr_tag with @@ -322,5 +323,8 @@ let same_record_representation x y = | Record_inlined y -> tag = y.tag && name = y.name && num_nonconsts = y.num_nonconsts && optional_labels = y.optional_labels | _ -> false) - | Record_extension -> y = Record_extension + | Record_extension {is_exception} -> ( + match y with + | Record_extension y -> is_exception = y.is_exception + | _ -> false) | Record_unboxed x -> ( match y with Record_unboxed y -> x = y | _ -> false) diff --git a/jscomp/ml/types.mli b/jscomp/ml/types.mli index 52ec4e8c93..f79f8cc221 100644 --- a/jscomp/ml/types.mli +++ b/jscomp/ml/types.mli @@ -302,7 +302,8 @@ and record_representation = | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) | Record_inlined of (* Inlined record *) { tag : int ; name : string; num_nonconsts : int; optional_labels : string list; attrs: Parsetree.attributes } - | Record_extension (* Inlined record under extension *) + | Record_extension of (* Inlined record under extension *) + { is_exception : bool } | Record_optional_labels of string list (* List of optional labels *) and label_declaration = @@ -434,7 +435,7 @@ and constructor_tag = Cstr_constant of int (* Constant constructor (an int) *) | Cstr_block of int (* Regular constructor (a block) *) | Cstr_unboxed (* Constructor of an unboxed type *) - | Cstr_extension of Path.t (* Extension constructor *) + | Cstr_extension of Path.t * bool (* Extension constructor. true if is_exception *) (* Constructors are the same *) val equal_tag : constructor_tag -> constructor_tag -> bool diff --git a/jscomp/runtime/caml_exceptions.res b/jscomp/runtime/caml_exceptions.res index 0ca8fee7af..1c1e2cd71c 100644 --- a/jscomp/runtime/caml_exceptions.res +++ b/jscomp/runtime/caml_exceptions.res @@ -89,12 +89,8 @@ let create = (str: string): string => { This is not a problem in `try .. with` since the logic above is not expressible, see more design in [destruct_exn.md] */ -let is_extension = (type a, e: a): bool => - if Js.testAny(e) { - false - } else { - Js.typeof((Obj.magic(e): t).id) == "string" - } +let is_extension = (any: 'a): bool => + Obj.magic(any) && Js.typeof((Obj.magic(any): t).id) === "string" /** FIXME: remove the trailing `/` */ let exn_slot_name = (x: t): string => x.id diff --git a/jscomp/runtime/caml_js_exceptions.res b/jscomp/runtime/caml_js_exceptions.res index ea41d4e3df..202d048dbc 100644 --- a/jscomp/runtime/caml_js_exceptions.res +++ b/jscomp/runtime/caml_js_exceptions.res @@ -23,16 +23,30 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ exception Error = JsError -type js_error = {cause: exn} -/** - This function has to be in this module Since - [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 + +%%raw(`class RescriptError extends Error { + constructor(message) { + super(message); + this.RE_EXN_ID = message; + } +}`) + +@new +external internalMakeExn: string => exn = "RescriptError" +// Reassign it here from external to let, since RescriptError is not exported +let internalMakeExn = internalMakeExn + +let internalFromExtension = (_ext: 'a): exn => { + %raw(`Object.assign(new RescriptError(_ext.RE_EXN_ID), _ext)`) +} + +let internalAnyToExn = (any: 'a): exn => + if Obj.magic(any) && Js.typeof(Obj.magic(any)["RE_EXN_ID"]) === "string" { + any->Obj.magic } else { - JsError(e) + let exn = internalMakeExn("JsError") + Obj.magic(exn)["_1"] = any + exn } let as_js_exn = exn => diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index b848fd71bc..2a2013c095 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -15,33 +15,33 @@ o runtime/js.cmj runtime/js.cmi : cc runtime/js.res bsc_flags = $bsc_no_open_flags o runtime/caml.cmj : cc_cmi runtime/caml.res | runtime/caml.cmi runtime/caml_int64_extern.cmj o runtime/caml.cmi : cc runtime/caml.resi | runtime/bs_stdlib_mini.cmi runtime/caml_int64_extern.cmj runtime/js.cmi runtime/js.cmj -o runtime/caml_array.cmj : cc_cmi runtime/caml_array.res | runtime/caml_array.cmi runtime/caml_array_extern.cmj +o runtime/caml_array.cmj : cc_cmi runtime/caml_array.res | runtime/caml_array.cmi runtime/caml_array_extern.cmj runtime/caml_js_exceptions.cmj o runtime/caml_array.cmi : cc runtime/caml_array.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_bigint.cmj : cc_cmi runtime/caml_bigint.res | runtime/caml_bigint.cmi runtime/caml_bigint_extern.cmj +o runtime/caml_bigint.cmj : cc_cmi runtime/caml_bigint.res | runtime/caml_bigint.cmi runtime/caml_bigint_extern.cmj runtime/caml_js_exceptions.cmj o runtime/caml_bigint.cmi : cc runtime/caml_bigint.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_bytes.cmj : cc_cmi runtime/caml_bytes.res | runtime/caml_bytes.cmi +o runtime/caml_bytes.cmj : cc_cmi runtime/caml_bytes.res | runtime/caml_bytes.cmi runtime/caml_js_exceptions.cmj o runtime/caml_bytes.cmi : cc runtime/caml_bytes.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.res | runtime/caml_exceptions.cmi o runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_float.cmj : cc_cmi runtime/caml_float.res | runtime/caml_float.cmi runtime/caml_float_extern.cmj o runtime/caml_float.cmi : cc runtime/caml_float.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_format.cmj : cc_cmi runtime/caml_format.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj +o runtime/caml_format.cmj : cc_cmi runtime/caml_format.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj o runtime/caml_format.cmi : cc runtime/caml_format.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.res | runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj o runtime/caml_hash.cmi : cc runtime/caml_hash.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_hash_primitive.cmj : cc_cmi runtime/caml_hash_primitive.res | runtime/caml_hash_primitive.cmi runtime/caml_string_extern.cmj o runtime/caml_hash_primitive.cmi : cc runtime/caml_hash_primitive.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_int32.cmj : cc_cmi runtime/caml_int32.res | runtime/caml_int32.cmi runtime/caml_nativeint_extern.cmj +o runtime/caml_int32.cmj : cc_cmi runtime/caml_int32.res | runtime/caml_int32.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmj o runtime/caml_int32.cmi : cc runtime/caml_int32.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_int64.cmj : cc_cmi runtime/caml_int64.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_int64.cmi runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj +o runtime/caml_int64.cmj : cc_cmi runtime/caml_int64.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_int64.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj o runtime/caml_int64.cmi : cc runtime/caml_int64.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_lexer.cmj : cc_cmi runtime/caml_lexer.res | runtime/caml_lexer.cmi +o runtime/caml_lexer.cmj : cc_cmi runtime/caml_lexer.res | runtime/caml_js_exceptions.cmj runtime/caml_lexer.cmi o runtime/caml_lexer.cmi : cc runtime/caml_lexer.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_md5.cmj : cc_cmi runtime/caml_md5.res | runtime/caml_array_extern.cmj runtime/caml_md5.cmi runtime/caml_string_extern.cmj o runtime/caml_md5.cmi : cc runtime/caml_md5.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_module.cmj : cc_cmi runtime/caml_module.res | runtime/caml_array_extern.cmj runtime/caml_module.cmi runtime/caml_obj.cmj +o runtime/caml_module.cmj : cc_cmi runtime/caml_module.res | runtime/caml_array_extern.cmj runtime/caml_js_exceptions.cmj runtime/caml_module.cmi runtime/caml_obj.cmj o runtime/caml_module.cmi : cc runtime/caml_module.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj +o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_js_exceptions.cmj runtime/caml_obj.cmi runtime/caml_option.cmj o runtime/caml_obj.cmi : cc runtime/caml_obj.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_option.cmj : cc_cmi runtime/caml_option.res | runtime/caml_option.cmi runtime/caml_undefined_extern.cmj o runtime/caml_option.cmi : cc runtime/caml_option.resi | runtime/bs_stdlib_mini.cmi runtime/caml_undefined_extern.cmj runtime/js.cmi runtime/js.cmj @@ -49,15 +49,15 @@ o runtime/caml_parser.cmj : cc_cmi runtime/caml_parser.res | runtime/caml_parser o runtime/caml_parser.cmi : cc runtime/caml_parser.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_splice_call.cmj : cc_cmi runtime/caml_splice_call.res | runtime/caml_splice_call.cmi o runtime/caml_splice_call.cmi : cc runtime/caml_splice_call.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_string.cmj : cc_cmi runtime/caml_string.res | runtime/caml_string.cmi runtime/caml_string_extern.cmj +o runtime/caml_string.cmj : cc_cmi runtime/caml_string.res | runtime/caml_js_exceptions.cmj runtime/caml_string.cmi runtime/caml_string_extern.cmj o runtime/caml_string.cmi : cc runtime/caml_string.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_sys.cmj : cc_cmi runtime/caml_sys.res | runtime/caml_array_extern.cmj runtime/caml_sys.cmi runtime/caml_undefined_extern.cmj +o runtime/caml_sys.cmj : cc_cmi runtime/caml_sys.res | runtime/caml_array_extern.cmj runtime/caml_js_exceptions.cmj runtime/caml_sys.cmi runtime/caml_undefined_extern.cmj o runtime/caml_sys.cmi : cc runtime/caml_sys.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj : cc runtime/caml_array_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj : cc runtime/caml_bigint_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj : cc runtime/caml_float_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj : cc runtime/caml_int64_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj : cc runtime/caml_js_exceptions.res | runtime/bs_stdlib_mini.cmi runtime/caml_exceptions.cmj runtime/caml_option.cmj runtime/js.cmi runtime/js.cmj +o runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj : cc runtime/caml_js_exceptions.res | runtime/bs_stdlib_mini.cmi runtime/caml_option.cmj runtime/js.cmi runtime/js.cmj o runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj : cc runtime/caml_nativeint_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj diff --git a/jscomp/test/406_primitive_test.js b/jscomp/test/406_primitive_test.js index 7292ab1928..e9d4dd475c 100644 --- a/jscomp/test/406_primitive_test.js +++ b/jscomp/test/406_primitive_test.js @@ -34,24 +34,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: A, + _1: 0 }); } } return; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..5bac113786 100644 --- a/jscomp/test/UncurriedExternals.js +++ b/jscomp/test/UncurriedExternals.js @@ -2,13 +2,10 @@ 'use strict'; let React = require("react"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function dd() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let h = sum(1.0, 2.0); @@ -27,9 +24,7 @@ function tg(arr) { let tc = Object.assign({}, "abc"); -let te = { - RE_EXN_ID: "Not_found" -}; +let te = Caml_js_exceptions.internalMakeExn("Not_found"); let tcr = {}; diff --git a/jscomp/test/adt_optimize_test.js b/jscomp/test/adt_optimize_test.js index 29405a959d..c2ab0181c6 100644 --- a/jscomp/test/adt_optimize_test.js +++ b/jscomp/test/adt_optimize_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(x) { switch (x) { @@ -182,15 +183,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "adt_optimize_test.res", + 202, + 9 + ] }); } diff --git a/jscomp/test/argv_test.js b/jscomp/test/argv_test.js index d324689acb..33bde28e5d 100644 --- a/jscomp/test/argv_test.js +++ b/jscomp/test/argv_test.js @@ -2,6 +2,7 @@ 'use strict'; let Arg = require("../../lib/js/arg.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function anno_fun(arg) { @@ -50,28 +51,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "argv_test.res", + 14, + 2 + ] }); } if (test.contents !== false) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "argv_test.res", - 15, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "argv_test.res", + 15, + 2 + ] }); } diff --git a/jscomp/test/arith_parser.js b/jscomp/test/arith_parser.js index 7520e20b28..671ee12227 100644 --- a/jscomp/test/arith_parser.js +++ b/jscomp/test/arith_parser.js @@ -2,6 +2,7 @@ 'use strict'; let Parsing = require("../../lib/js/parsing.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let yytransl_const = [ 259, @@ -140,11 +141,9 @@ let yynames_block = "\ let yyact = [ param => { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "parser" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "parser" }); }, __caml_parser_env => Parsing.peek_val(__caml_parser_env, 1), @@ -207,11 +206,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parsing.YYexit, + _1: Parsing.peek_val(__caml_parser_env, 0) }); } ]; diff --git a/jscomp/test/arity_infer.js b/jscomp/test/arity_infer.js index 18da9fe57b..36c5caea83 100644 --- a/jscomp/test/arity_infer.js +++ b/jscomp/test/arity_infer.js @@ -1,27 +1,20 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f0(x) { let tmp; if (x > 3) { tmp = x => x + 1 | 0; } else { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } return tmp(3); } function f1(x) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); return undefined(x); } @@ -41,11 +34,7 @@ function f3(x) { tmp = x => x + 4 | 0; break; default: - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } return tmp(3); } diff --git a/jscomp/test/array_safe_get.js b/jscomp/test/array_safe_get.js index ce8a0437bf..b07f772c83 100644 --- a/jscomp/test/array_safe_get.js +++ b/jscomp/test/array_safe_get.js @@ -14,14 +14,12 @@ let y; try { y = Caml_array.get(x, 3); } catch (raw_msg) { - let msg = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg.RE_EXN_ID === "Invalid_argument") { 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..a27f02550c 100644 --- a/jscomp/test/array_test.js +++ b/jscomp/test/array_test.js @@ -20,23 +20,17 @@ 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 Caml_js_exceptions.internalMakeExn(H); } } return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..632871824a 100644 --- a/jscomp/test/bb.js +++ b/jscomp/test/bb.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(x) { if (x === "b") { @@ -21,15 +22,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bb.res", + 13, + 9 + ] }); } } @@ -47,15 +46,13 @@ function test(x) { match = "c"; break; default: - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bb.res", - 21, - 9 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bb.res", + 21, + 9 + ] }); } if (match === "b") { diff --git a/jscomp/test/bdd.js b/jscomp/test/bdd.js index a7b4f929b5..78c22e8e72 100644 --- a/jscomp/test/bdd.js +++ b/jscomp/test/bdd.js @@ -2,6 +2,7 @@ 'use strict'; let Caml_array = require("../../lib/js/caml_array.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function $$eval(_bdd, vars) { while (true) { @@ -67,26 +68,22 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Assert_failure", _1: [ "bdd.res", 60, 13 ] - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 60, + 13 + ] }); } else { let ind = hashVal(getId(n._0), getId(n._3), n._1) & newSz_1; @@ -145,26 +142,22 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Assert_failure", _1: [ "bdd.res", 121, 15 ] - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 121, + 15 + ] }); } else { if (v === n._1 && idl === getId(n._0) && idh === getId(n._3)) { @@ -402,15 +395,13 @@ function main() { if (succeeded) { return; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 301, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 301, + 2 + ] }); } diff --git a/jscomp/test/bench.js b/jscomp/test/bench.js index 8223ef2471..5add4ecc74 100644 --- a/jscomp/test/bench.js +++ b/jscomp/test/bench.js @@ -3,6 +3,7 @@ let Caml_array = require("../../lib/js/caml_array.js"); let Pervasives = require("../../lib/js/pervasives.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function map(f, a) { let f$1 = x => f(x); @@ -23,11 +24,9 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.init" }); } let res = Caml_array.make(l, f$1(0)); diff --git a/jscomp/test/big_polyvar_test.js b/jscomp/test/big_polyvar_test.js index 3cf61f097f..9bc4a45f88 100644 --- a/jscomp/test/big_polyvar_test.js +++ b/jscomp/test/big_polyvar_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let _map = {"variant0":"variant0","variant1":"variant1","variant2":"variant2","variant3":"variant3","variant4":"variant4","variant5":"variant5","variant6":"variant6","variant7":"variant7","variant8":"variant8","variant9":"variant9","variant10":"variant10","variant11":"variant11","variant12":"variant12","variant13":"variant13","variant14":"variant14","variant15":"variant15","variant16":"variant16","variant17":"variant17","variant18":"variant18","variant19":"variant19","variant20":"variant20","variant21":"variant21","variant22":"variant22","variant23":"variant23","variant24":"variant24","variant25":"variant25","variant26":"variant26","variant27":"variant27","variant28":"variant28","variant29":"variant29","variant30":"variant30","variant31":"variant31","variant32":"variant32","variant33":"variant33","variant34":"variant34","variant35":"variant35","variant36":"variant36","variant37":"variant37","variant38":"variant38","variant39":"variant39","variant40":"variant40","variant41":"variant41","variant42":"variant42","variant43":"variant43","variant44":"variant44","variant45":"variant45","variant46":"variant46","variant47":"variant47","variant48":"variant48","variant49":"variant49","variant50":"variant50","variant51":"variant51","variant52":"variant52","variant53":"variant53","variant54":"variant54","variant55":"variant55","variant56":"variant56","variant57":"variant57","variant58":"variant58","variant59":"variant59","variant60":"variant60","variant61":"variant61","variant62":"variant62","variant63":"variant63","variant64":"variant64","variant65":"variant65","variant66":"variant66","variant67":"variant67","variant68":"variant68","variant69":"variant69","variant70":"variant70","variant71":"variant71","variant72":"variant72","variant73":"variant73","variant74":"variant74","variant75":"variant75","variant76":"variant76","variant77":"variant77","variant78":"variant78","variant79":"variant79","variant80":"variant80","variant81":"variant81","variant82":"variant82","variant83":"variant83","variant84":"variant84","variant85":"variant85","variant86":"variant86","variant87":"variant87","variant88":"variant88","variant89":"variant89","variant90":"variant90","variant91":"variant91","variant92":"variant92","variant93":"variant93","variant94":"variant94","variant95":"variant95","variant96":"variant96","variant97":"variant97","variant98":"variant98","variant99":"variant99","variant100":"variant100","variant101":"variant101","variant102":"variant102","variant103":"variant103","variant104":"variant104","variant105":"variant105","variant106":"variant106","variant107":"variant107","variant108":"variant108","variant109":"variant109","variant110":"variant110","variant111":"variant111","variant112":"variant112","variant113":"variant113","variant114":"variant114","variant115":"variant115","variant116":"variant116","variant117":"variant117","variant118":"variant118","variant119":"variant119","variant120":"variant120","variant121":"variant121","variant122":"variant122","variant123":"variant123","variant124":"variant124","variant125":"variant125","variant126":"variant126","variant127":"variant127","variant128":"variant128","variant129":"variant129","variant130":"variant130","variant131":"variant131","variant132":"variant132","variant133":"variant133","variant134":"variant134","variant135":"variant135","variant136":"variant136","variant137":"variant137","variant138":"variant138","variant139":"variant139","variant140":"variant140","variant141":"variant141","variant142":"variant142","variant143":"variant143","variant144":"variant144","variant145":"variant145","variant146":"variant146","variant147":"variant147","variant148":"variant148","variant149":"variant149","variant150":"variant150","variant151":"variant151","variant152":"variant152","variant153":"variant153","variant154":"variant154","variant155":"variant155","variant156":"variant156","variant157":"variant157","variant158":"variant158","variant159":"variant159","variant160":"variant160","variant161":"variant161","variant162":"variant162","variant163":"variant163","variant164":"variant164","variant165":"variant165","variant166":"variant166","variant167":"variant167","variant168":"variant168","variant169":"variant169","variant170":"variant170","variant171":"variant171","variant172":"variant172","variant173":"variant173","variant174":"variant174","variant175":"variant175","variant176":"variant176","variant177":"variant177","variant178":"variant178","variant179":"variant179","variant180":"variant180","variant181":"variant181","variant182":"variant182","variant183":"variant183","variant184":"variant184","variant185":"variant185","variant186":"variant186","variant187":"variant187","variant188":"variant188","variant189":"variant189","variant190":"variant190","variant191":"variant191","variant192":"variant192","variant193":"variant193","variant194":"variant194","variant195":"variant195","variant196":"variant196","variant197":"variant197","variant198":"variant198","variant199":"variant199","variant200":"variant200","variant201":"variant201","variant202":"variant202","variant203":"variant203","variant204":"variant204","variant205":"variant205","variant206":"variant206","variant207":"variant207","variant208":"variant208","variant209":"variant209","variant210":"variant210","variant211":"variant211","variant212":"variant212","variant213":"variant213","variant214":"variant214","variant215":"variant215","variant216":"variant216","variant217":"variant217","variant218":"variant218","variant219":"variant219","variant220":"variant220","variant221":"variant221","variant222":"variant222","variant223":"variant223","variant224":"variant224","variant225":"variant225","variant226":"variant226","variant227":"variant227","variant228":"variant228","variant229":"variant229","variant230":"variant230","variant231":"variant231","variant232":"variant232","variant233":"variant233","variant234":"variant234","variant235":"variant235","variant236":"variant236","variant237":"variant237","variant238":"variant238","variant239":"variant239","variant240":"variant240","variant241":"variant241","variant242":"variant242","variant243":"variant243","variant244":"variant244","variant245":"variant245","variant246":"variant246","variant247":"variant247","variant248":"variant248","variant249":"variant249","variant250":"variant250","variant251":"variant251","variant252":"variant252","variant253":"variant253","variant254":"variant254","variant255":"variant255","variant256":"variant256","variant257":"variant257","variant258":"variant258","variant259":"variant259","variant260":"variant260","variant261":"variant261","variant262":"variant262","variant263":"variant263","variant264":"variant264","variant265":"variant265","variant266":"variant266","variant267":"variant267","variant268":"variant268","variant269":"variant269","variant270":"variant270","variant271":"variant271","variant272":"variant272","variant273":"variant273","variant274":"variant274","variant275":"variant275","variant276":"variant276","variant277":"variant277","variant278":"variant278","variant279":"variant279","variant280":"variant280","variant281":"variant281","variant282":"variant282","variant283":"variant283","variant284":"variant284","variant285":"variant285","variant286":"variant286","variant287":"variant287","variant288":"variant288","variant289":"variant289","variant290":"variant290","variant291":"variant291","variant292":"variant292","variant293":"variant293","variant294":"variant294","variant295":"variant295","variant296":"variant296","variant297":"variant297","variant298":"variant298","variant299":"variant299"}; @@ -25,7815 +26,6613 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 314, + 0 + ] }); } if ("variant1" !== "variant1") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 315, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 315, + 0 + ] }); } if ("variant2" !== "variant2") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 316, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 316, + 0 + ] }); } if ("variant3" !== "variant3") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 317, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 317, + 0 + ] }); } if ("variant4" !== "variant4") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 318, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 318, + 0 + ] }); } if ("variant5" !== "variant5") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 319, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 319, + 0 + ] }); } if ("variant6" !== "variant6") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 320, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 320, + 0 + ] }); } if ("variant7" !== "variant7") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 321, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 321, + 0 + ] }); } if ("variant8" !== "variant8") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 322, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 322, + 0 + ] }); } if ("variant9" !== "variant9") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 323, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 323, + 0 + ] }); } if ("variant10" !== "variant10") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 324, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 324, + 0 + ] }); } if ("variant11" !== "variant11") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 325, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 325, + 0 + ] }); } if ("variant12" !== "variant12") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 326, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 326, + 0 + ] }); } if ("variant13" !== "variant13") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 327, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 327, + 0 + ] }); } if ("variant14" !== "variant14") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 328, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 328, + 0 + ] }); } if ("variant15" !== "variant15") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 329, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 329, + 0 + ] }); } if ("variant16" !== "variant16") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 330, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 330, + 0 + ] }); } if ("variant17" !== "variant17") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 331, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 331, + 0 + ] }); } if ("variant18" !== "variant18") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 332, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 332, + 0 + ] }); } if ("variant19" !== "variant19") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 333, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 333, + 0 + ] }); } if ("variant20" !== "variant20") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 334, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 334, + 0 + ] }); } if ("variant21" !== "variant21") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 335, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 335, + 0 + ] }); } if ("variant22" !== "variant22") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 336, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 336, + 0 + ] }); } if ("variant23" !== "variant23") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 337, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 337, + 0 + ] }); } if ("variant24" !== "variant24") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 338, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 338, + 0 + ] }); } if ("variant25" !== "variant25") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 339, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 339, + 0 + ] }); } if ("variant26" !== "variant26") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 340, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 340, + 0 + ] }); } if ("variant27" !== "variant27") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 341, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 341, + 0 + ] }); } if ("variant28" !== "variant28") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 342, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 342, + 0 + ] }); } if ("variant29" !== "variant29") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 343, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 343, + 0 + ] }); } if ("variant30" !== "variant30") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 344, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 344, + 0 + ] }); } if ("variant31" !== "variant31") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 345, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 345, + 0 + ] }); } if ("variant32" !== "variant32") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 346, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 346, + 0 + ] }); } if ("variant33" !== "variant33") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 347, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 347, + 0 + ] }); } if ("variant34" !== "variant34") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 348, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 348, + 0 + ] }); } if ("variant35" !== "variant35") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 349, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 349, + 0 + ] }); } if ("variant36" !== "variant36") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 350, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 350, + 0 + ] }); } if ("variant37" !== "variant37") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 351, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 351, + 0 + ] }); } if ("variant38" !== "variant38") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 352, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 352, + 0 + ] }); } if ("variant39" !== "variant39") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 353, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 353, + 0 + ] }); } if ("variant40" !== "variant40") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 354, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 354, + 0 + ] }); } if ("variant41" !== "variant41") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 355, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 355, + 0 + ] }); } if ("variant42" !== "variant42") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 356, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 356, + 0 + ] }); } if ("variant43" !== "variant43") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 357, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 357, + 0 + ] }); } if ("variant44" !== "variant44") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 358, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 358, + 0 + ] }); } if ("variant45" !== "variant45") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 359, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 359, + 0 + ] }); } if ("variant46" !== "variant46") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 360, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 360, + 0 + ] }); } if ("variant47" !== "variant47") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 361, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 361, + 0 + ] }); } if ("variant48" !== "variant48") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 362, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 362, + 0 + ] }); } if ("variant49" !== "variant49") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 363, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 363, + 0 + ] }); } if ("variant50" !== "variant50") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 364, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 364, + 0 + ] }); } if ("variant51" !== "variant51") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 365, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 365, + 0 + ] }); } if ("variant52" !== "variant52") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 366, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 366, + 0 + ] }); } if ("variant53" !== "variant53") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 367, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 367, + 0 + ] }); } if ("variant54" !== "variant54") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 368, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 368, + 0 + ] }); } if ("variant55" !== "variant55") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 369, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 369, + 0 + ] }); } if ("variant56" !== "variant56") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 370, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 370, + 0 + ] }); } if ("variant57" !== "variant57") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 371, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 371, + 0 + ] }); } if ("variant58" !== "variant58") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 372, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 372, + 0 + ] }); } if ("variant59" !== "variant59") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 373, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 373, + 0 + ] }); } if ("variant60" !== "variant60") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 374, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 374, + 0 + ] }); } if ("variant61" !== "variant61") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 375, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 375, + 0 + ] }); } if ("variant62" !== "variant62") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 376, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 376, + 0 + ] }); } if ("variant63" !== "variant63") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 377, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 377, + 0 + ] }); } if ("variant64" !== "variant64") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 378, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 378, + 0 + ] }); } if ("variant65" !== "variant65") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 379, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 379, + 0 + ] }); } if ("variant66" !== "variant66") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 380, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 380, + 0 + ] }); } if ("variant67" !== "variant67") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 381, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 381, + 0 + ] }); } if ("variant68" !== "variant68") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 382, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 382, + 0 + ] }); } if ("variant69" !== "variant69") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 383, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 383, + 0 + ] }); } if ("variant70" !== "variant70") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 384, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 384, + 0 + ] }); } if ("variant71" !== "variant71") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 385, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 385, + 0 + ] }); } if ("variant72" !== "variant72") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 386, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 386, + 0 + ] }); } if ("variant73" !== "variant73") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 387, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 387, + 0 + ] }); } if ("variant74" !== "variant74") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 388, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 388, + 0 + ] }); } if ("variant75" !== "variant75") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 389, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 389, + 0 + ] }); } if ("variant76" !== "variant76") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 390, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 390, + 0 + ] }); } if ("variant77" !== "variant77") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 391, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 391, + 0 + ] }); } if ("variant78" !== "variant78") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 392, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 392, + 0 + ] }); } if ("variant79" !== "variant79") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 393, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 393, + 0 + ] }); } if ("variant80" !== "variant80") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 394, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 394, + 0 + ] }); } if ("variant81" !== "variant81") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 395, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 395, + 0 + ] }); } if ("variant82" !== "variant82") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 396, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 396, + 0 + ] }); } if ("variant83" !== "variant83") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 397, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 397, + 0 + ] }); } if ("variant84" !== "variant84") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 398, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 398, + 0 + ] }); } if ("variant85" !== "variant85") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 399, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 399, + 0 + ] }); } if ("variant86" !== "variant86") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 400, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 400, + 0 + ] }); } if ("variant87" !== "variant87") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 401, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 401, + 0 + ] }); } if ("variant88" !== "variant88") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 402, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 402, + 0 + ] }); } if ("variant89" !== "variant89") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 403, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 403, + 0 + ] }); } if ("variant90" !== "variant90") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 404, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 404, + 0 + ] }); } if ("variant91" !== "variant91") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 405, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 405, + 0 + ] }); } if ("variant92" !== "variant92") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 406, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 406, + 0 + ] }); } if ("variant93" !== "variant93") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 407, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 407, + 0 + ] }); } if ("variant94" !== "variant94") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 408, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 408, + 0 + ] }); } if ("variant95" !== "variant95") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 409, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 409, + 0 + ] }); } if ("variant96" !== "variant96") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 410, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 410, + 0 + ] }); } if ("variant97" !== "variant97") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 411, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 411, + 0 + ] }); } if ("variant98" !== "variant98") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 412, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 412, + 0 + ] }); } if ("variant99" !== "variant99") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 413, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 413, + 0 + ] }); } if ("variant100" !== "variant100") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 414, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 414, + 0 + ] }); } if ("variant101" !== "variant101") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 415, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 415, + 0 + ] }); } if ("variant102" !== "variant102") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 416, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 416, + 0 + ] }); } if ("variant103" !== "variant103") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 417, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 417, + 0 + ] }); } if ("variant104" !== "variant104") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 418, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 418, + 0 + ] }); } if ("variant105" !== "variant105") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 419, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 419, + 0 + ] }); } if ("variant106" !== "variant106") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 420, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 420, + 0 + ] }); } if ("variant107" !== "variant107") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 421, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 421, + 0 + ] }); } if ("variant108" !== "variant108") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 422, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 422, + 0 + ] }); } if ("variant109" !== "variant109") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 423, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 423, + 0 + ] }); } if ("variant110" !== "variant110") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 424, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 424, + 0 + ] }); } if ("variant111" !== "variant111") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 425, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 425, + 0 + ] }); } if ("variant112" !== "variant112") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 426, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 426, + 0 + ] }); } if ("variant113" !== "variant113") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 427, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 427, + 0 + ] }); } if ("variant114" !== "variant114") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 428, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 428, + 0 + ] }); } if ("variant115" !== "variant115") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 429, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 429, + 0 + ] }); } if ("variant116" !== "variant116") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 430, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 430, + 0 + ] }); } if ("variant117" !== "variant117") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 431, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 431, + 0 + ] }); } if ("variant118" !== "variant118") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 432, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 432, + 0 + ] }); } if ("variant119" !== "variant119") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 433, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 433, + 0 + ] }); } if ("variant120" !== "variant120") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 434, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 434, + 0 + ] }); } if ("variant121" !== "variant121") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 435, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 435, + 0 + ] }); } if ("variant122" !== "variant122") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 436, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 436, + 0 + ] }); } if ("variant123" !== "variant123") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 437, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 437, + 0 + ] }); } if ("variant124" !== "variant124") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 438, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 438, + 0 + ] }); } if ("variant125" !== "variant125") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 439, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 439, + 0 + ] }); } if ("variant126" !== "variant126") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 440, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 440, + 0 + ] }); } if ("variant127" !== "variant127") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 441, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 441, + 0 + ] }); } if ("variant128" !== "variant128") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 442, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 442, + 0 + ] }); } if ("variant129" !== "variant129") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 443, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 443, + 0 + ] }); } if ("variant130" !== "variant130") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 444, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 444, + 0 + ] }); } if ("variant131" !== "variant131") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 445, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 445, + 0 + ] }); } if ("variant132" !== "variant132") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 446, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 446, + 0 + ] }); } if ("variant133" !== "variant133") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 447, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 447, + 0 + ] }); } if ("variant134" !== "variant134") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 448, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 448, + 0 + ] }); } if ("variant135" !== "variant135") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 449, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 449, + 0 + ] }); } if ("variant136" !== "variant136") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 450, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 450, + 0 + ] }); } if ("variant137" !== "variant137") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 451, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 451, + 0 + ] }); } if ("variant138" !== "variant138") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 452, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 452, + 0 + ] }); } if ("variant139" !== "variant139") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 453, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 453, + 0 + ] }); } if ("variant140" !== "variant140") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 454, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 454, + 0 + ] }); } if ("variant141" !== "variant141") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 455, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 455, + 0 + ] }); } if ("variant142" !== "variant142") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 456, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 456, + 0 + ] }); } if ("variant143" !== "variant143") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 457, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 457, + 0 + ] }); } if ("variant144" !== "variant144") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 458, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 458, + 0 + ] }); } if ("variant145" !== "variant145") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 459, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 459, + 0 + ] }); } if ("variant146" !== "variant146") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 460, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 460, + 0 + ] }); } if ("variant147" !== "variant147") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 461, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 461, + 0 + ] }); } if ("variant148" !== "variant148") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 462, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 462, + 0 + ] }); } if ("variant149" !== "variant149") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 463, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 463, + 0 + ] }); } if ("variant150" !== "variant150") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 464, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 464, + 0 + ] }); } if ("variant151" !== "variant151") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 465, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 465, + 0 + ] }); } if ("variant152" !== "variant152") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 466, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 466, + 0 + ] }); } if ("variant153" !== "variant153") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 467, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 467, + 0 + ] }); } if ("variant154" !== "variant154") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 468, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 468, + 0 + ] }); } if ("variant155" !== "variant155") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 469, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 469, + 0 + ] }); } if ("variant156" !== "variant156") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 470, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 470, + 0 + ] }); } if ("variant157" !== "variant157") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 471, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 471, + 0 + ] }); } if ("variant158" !== "variant158") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 472, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 472, + 0 + ] }); } if ("variant159" !== "variant159") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 473, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 473, + 0 + ] }); } if ("variant160" !== "variant160") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 474, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 474, + 0 + ] }); } if ("variant161" !== "variant161") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 475, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 475, + 0 + ] }); } if ("variant162" !== "variant162") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 476, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 476, + 0 + ] }); } if ("variant163" !== "variant163") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 477, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 477, + 0 + ] }); } if ("variant164" !== "variant164") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 478, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 478, + 0 + ] }); } if ("variant165" !== "variant165") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 479, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 479, + 0 + ] }); } if ("variant166" !== "variant166") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 480, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 480, + 0 + ] }); } if ("variant167" !== "variant167") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 481, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 481, + 0 + ] }); } if ("variant168" !== "variant168") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 482, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 482, + 0 + ] }); } if ("variant169" !== "variant169") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 483, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 483, + 0 + ] }); } if ("variant170" !== "variant170") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 484, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 484, + 0 + ] }); } if ("variant171" !== "variant171") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 485, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 485, + 0 + ] }); } if ("variant172" !== "variant172") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 486, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 486, + 0 + ] }); } if ("variant173" !== "variant173") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 487, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 487, + 0 + ] }); } if ("variant174" !== "variant174") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 488, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 488, + 0 + ] }); } if ("variant175" !== "variant175") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 489, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 489, + 0 + ] }); } if ("variant176" !== "variant176") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 490, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 490, + 0 + ] }); } if ("variant177" !== "variant177") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 491, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 491, + 0 + ] }); } if ("variant178" !== "variant178") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 492, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 492, + 0 + ] }); } if ("variant179" !== "variant179") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 493, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 493, + 0 + ] }); } if ("variant180" !== "variant180") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 494, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 494, + 0 + ] }); } if ("variant181" !== "variant181") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 495, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 495, + 0 + ] }); } if ("variant182" !== "variant182") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 496, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 496, + 0 + ] }); } if ("variant183" !== "variant183") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 497, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 497, + 0 + ] }); } if ("variant184" !== "variant184") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 498, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 498, + 0 + ] }); } if ("variant185" !== "variant185") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 499, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 499, + 0 + ] }); } if ("variant186" !== "variant186") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 500, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 500, + 0 + ] }); } if ("variant187" !== "variant187") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 501, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 501, + 0 + ] }); } if ("variant188" !== "variant188") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 502, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 502, + 0 + ] }); } if ("variant189" !== "variant189") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 503, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 503, + 0 + ] }); } if ("variant190" !== "variant190") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 504, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 504, + 0 + ] }); } if ("variant191" !== "variant191") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 505, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 505, + 0 + ] }); } if ("variant192" !== "variant192") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 506, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 506, + 0 + ] }); } if ("variant193" !== "variant193") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 507, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 507, + 0 + ] }); } if ("variant194" !== "variant194") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 508, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 508, + 0 + ] }); } if ("variant195" !== "variant195") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 509, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 509, + 0 + ] }); } if ("variant196" !== "variant196") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 510, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 510, + 0 + ] }); } if ("variant197" !== "variant197") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 511, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 511, + 0 + ] }); } if ("variant198" !== "variant198") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 512, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 512, + 0 + ] }); } if ("variant199" !== "variant199") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 513, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 513, + 0 + ] }); } if ("variant200" !== "variant200") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 514, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 514, + 0 + ] }); } if ("variant201" !== "variant201") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 515, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 515, + 0 + ] }); } if ("variant202" !== "variant202") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 516, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 516, + 0 + ] }); } if ("variant203" !== "variant203") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 517, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 517, + 0 + ] }); } if ("variant204" !== "variant204") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 518, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 518, + 0 + ] }); } if ("variant205" !== "variant205") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 519, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 519, + 0 + ] }); } if ("variant206" !== "variant206") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 520, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 520, + 0 + ] }); } if ("variant207" !== "variant207") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 521, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 521, + 0 + ] }); } if ("variant208" !== "variant208") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 522, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 522, + 0 + ] }); } if ("variant209" !== "variant209") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 523, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 523, + 0 + ] }); } if ("variant210" !== "variant210") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 524, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 524, + 0 + ] }); } if ("variant211" !== "variant211") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 525, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 525, + 0 + ] }); } if ("variant212" !== "variant212") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 526, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 526, + 0 + ] }); } if ("variant213" !== "variant213") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 527, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 527, + 0 + ] }); } if ("variant214" !== "variant214") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 528, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 528, + 0 + ] }); } if ("variant215" !== "variant215") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 529, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 529, + 0 + ] }); } if ("variant216" !== "variant216") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 530, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 530, + 0 + ] }); } if ("variant217" !== "variant217") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 531, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 531, + 0 + ] }); } if ("variant218" !== "variant218") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 532, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 532, + 0 + ] }); } if ("variant219" !== "variant219") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 533, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 533, + 0 + ] }); } if ("variant220" !== "variant220") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 534, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 534, + 0 + ] }); } if ("variant221" !== "variant221") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 535, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 535, + 0 + ] }); } if ("variant222" !== "variant222") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 536, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 536, + 0 + ] }); } if ("variant223" !== "variant223") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 537, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 537, + 0 + ] }); } if ("variant224" !== "variant224") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 538, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 538, + 0 + ] }); } if ("variant225" !== "variant225") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 539, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 539, + 0 + ] }); } if ("variant226" !== "variant226") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 540, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 540, + 0 + ] }); } if ("variant227" !== "variant227") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 541, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 541, + 0 + ] }); } if ("variant228" !== "variant228") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 542, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 542, + 0 + ] }); } if ("variant229" !== "variant229") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 543, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 543, + 0 + ] }); } if ("variant230" !== "variant230") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 544, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 544, + 0 + ] }); } if ("variant231" !== "variant231") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 545, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 545, + 0 + ] }); } if ("variant232" !== "variant232") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 546, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 546, + 0 + ] }); } if ("variant233" !== "variant233") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 547, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 547, + 0 + ] }); } if ("variant234" !== "variant234") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 548, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 548, + 0 + ] }); } if ("variant235" !== "variant235") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 549, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 549, + 0 + ] }); } if ("variant236" !== "variant236") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 550, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 550, + 0 + ] }); } if ("variant237" !== "variant237") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 551, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 551, + 0 + ] }); } if ("variant238" !== "variant238") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 552, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 552, + 0 + ] }); } if ("variant239" !== "variant239") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 553, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 553, + 0 + ] }); } if ("variant240" !== "variant240") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 554, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 554, + 0 + ] }); } if ("variant241" !== "variant241") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 555, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 555, + 0 + ] }); } if ("variant242" !== "variant242") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 556, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 556, + 0 + ] }); } if ("variant243" !== "variant243") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 557, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 557, + 0 + ] }); } if ("variant244" !== "variant244") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 558, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 558, + 0 + ] }); } if ("variant245" !== "variant245") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 559, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 559, + 0 + ] }); } if ("variant246" !== "variant246") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 560, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 560, + 0 + ] }); } if ("variant247" !== "variant247") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 561, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 561, + 0 + ] }); } if ("variant248" !== "variant248") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 562, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 562, + 0 + ] }); } if ("variant249" !== "variant249") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 563, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 563, + 0 + ] }); } if ("variant250" !== "variant250") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 564, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 564, + 0 + ] }); } if ("variant251" !== "variant251") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 565, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 565, + 0 + ] }); } if ("variant252" !== "variant252") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 566, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 566, + 0 + ] }); } if ("variant253" !== "variant253") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 567, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 567, + 0 + ] }); } if ("variant254" !== "variant254") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 568, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 568, + 0 + ] }); } if ("variant255" !== "variant255") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 569, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 569, + 0 + ] }); } if ("variant256" !== "variant256") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 570, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 570, + 0 + ] }); } if ("variant257" !== "variant257") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 571, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 571, + 0 + ] }); } if ("variant258" !== "variant258") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 572, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 572, + 0 + ] }); } if ("variant259" !== "variant259") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 573, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 573, + 0 + ] }); } if ("variant260" !== "variant260") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 574, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 574, + 0 + ] }); } if ("variant261" !== "variant261") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 575, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 575, + 0 + ] }); } if ("variant262" !== "variant262") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 576, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 576, + 0 + ] }); } if ("variant263" !== "variant263") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 577, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 577, + 0 + ] }); } if ("variant264" !== "variant264") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 578, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 578, + 0 + ] }); } if ("variant265" !== "variant265") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 579, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 579, + 0 + ] }); } if ("variant266" !== "variant266") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 580, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 580, + 0 + ] }); } if ("variant267" !== "variant267") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 581, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 581, + 0 + ] }); } if ("variant268" !== "variant268") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 582, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 582, + 0 + ] }); } if ("variant269" !== "variant269") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 583, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 583, + 0 + ] }); } if ("variant270" !== "variant270") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 584, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 584, + 0 + ] }); } if ("variant271" !== "variant271") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 585, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 585, + 0 + ] }); } if ("variant272" !== "variant272") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 586, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 586, + 0 + ] }); } if ("variant273" !== "variant273") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 587, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 587, + 0 + ] }); } if ("variant274" !== "variant274") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 588, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 588, + 0 + ] }); } if ("variant275" !== "variant275") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 589, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 589, + 0 + ] }); } if ("variant276" !== "variant276") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 590, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 590, + 0 + ] }); } if ("variant277" !== "variant277") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 591, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 591, + 0 + ] }); } if ("variant278" !== "variant278") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 592, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 592, + 0 + ] }); } if ("variant279" !== "variant279") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 593, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 593, + 0 + ] }); } if ("variant280" !== "variant280") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 594, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 594, + 0 + ] }); } if ("variant281" !== "variant281") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 595, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 595, + 0 + ] }); } if ("variant282" !== "variant282") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 596, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 596, + 0 + ] }); } if ("variant283" !== "variant283") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 597, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 597, + 0 + ] }); } if ("variant284" !== "variant284") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 598, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 598, + 0 + ] }); } if ("variant285" !== "variant285") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 599, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 599, + 0 + ] }); } if ("variant286" !== "variant286") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 600, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 600, + 0 + ] }); } if ("variant287" !== "variant287") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 601, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 601, + 0 + ] }); } if ("variant288" !== "variant288") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 602, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 602, + 0 + ] }); } if ("variant289" !== "variant289") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 603, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 603, + 0 + ] }); } if ("variant290" !== "variant290") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 604, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 604, + 0 + ] }); } if ("variant291" !== "variant291") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 605, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 605, + 0 + ] }); } if ("variant292" !== "variant292") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 606, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 606, + 0 + ] }); } if ("variant293" !== "variant293") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 607, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 607, + 0 + ] }); } if ("variant294" !== "variant294") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 608, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 608, + 0 + ] }); } if ("variant295" !== "variant295") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 609, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 609, + 0 + ] }); } if ("variant296" !== "variant296") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 610, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 610, + 0 + ] }); } if ("variant297" !== "variant297") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 611, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 611, + 0 + ] }); } if ("variant298" !== "variant298") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 612, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 612, + 0 + ] }); } if ("variant299" !== "variant299") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 613, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 613, + 0 + ] }); } if (!eq(tFromJs("variant0"), "variant0")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 614, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 614, + 0 + ] }); } if (!eq(tFromJs("variant1"), "variant1")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 615, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 615, + 0 + ] }); } if (!eq(tFromJs("variant2"), "variant2")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 616, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 616, + 0 + ] }); } if (!eq(tFromJs("variant3"), "variant3")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 617, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 617, + 0 + ] }); } if (!eq(tFromJs("variant4"), "variant4")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 618, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 618, + 0 + ] }); } if (!eq(tFromJs("variant5"), "variant5")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 619, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 619, + 0 + ] }); } if (!eq(tFromJs("variant6"), "variant6")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 620, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 620, + 0 + ] }); } if (!eq(tFromJs("variant7"), "variant7")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 621, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 621, + 0 + ] }); } if (!eq(tFromJs("variant8"), "variant8")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 622, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 622, + 0 + ] }); } if (!eq(tFromJs("variant9"), "variant9")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 623, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 623, + 0 + ] }); } if (!eq(tFromJs("variant10"), "variant10")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 624, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 624, + 0 + ] }); } if (!eq(tFromJs("variant11"), "variant11")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 625, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 625, + 0 + ] }); } if (!eq(tFromJs("variant12"), "variant12")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 626, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 626, + 0 + ] }); } if (!eq(tFromJs("variant13"), "variant13")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 627, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 627, + 0 + ] }); } if (!eq(tFromJs("variant14"), "variant14")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 628, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 628, + 0 + ] }); } if (!eq(tFromJs("variant15"), "variant15")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 629, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 629, + 0 + ] }); } if (!eq(tFromJs("variant16"), "variant16")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 630, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 630, + 0 + ] }); } if (!eq(tFromJs("variant17"), "variant17")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 631, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 631, + 0 + ] }); } if (!eq(tFromJs("variant18"), "variant18")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 632, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 632, + 0 + ] }); } if (!eq(tFromJs("variant19"), "variant19")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 633, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 633, + 0 + ] }); } if (!eq(tFromJs("variant20"), "variant20")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 634, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 634, + 0 + ] }); } if (!eq(tFromJs("variant21"), "variant21")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 635, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 635, + 0 + ] }); } if (!eq(tFromJs("variant22"), "variant22")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 636, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 636, + 0 + ] }); } if (!eq(tFromJs("variant23"), "variant23")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 637, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 637, + 0 + ] }); } if (!eq(tFromJs("variant24"), "variant24")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 638, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 638, + 0 + ] }); } if (!eq(tFromJs("variant25"), "variant25")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 639, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 639, + 0 + ] }); } if (!eq(tFromJs("variant26"), "variant26")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 640, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 640, + 0 + ] }); } if (!eq(tFromJs("variant27"), "variant27")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 641, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 641, + 0 + ] }); } if (!eq(tFromJs("variant28"), "variant28")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 642, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 642, + 0 + ] }); } if (!eq(tFromJs("variant29"), "variant29")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 643, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 643, + 0 + ] }); } if (!eq(tFromJs("variant30"), "variant30")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 644, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 644, + 0 + ] }); } if (!eq(tFromJs("variant31"), "variant31")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 645, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 645, + 0 + ] }); } if (!eq(tFromJs("variant32"), "variant32")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 646, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 646, + 0 + ] }); } if (!eq(tFromJs("variant33"), "variant33")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 647, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 647, + 0 + ] }); } if (!eq(tFromJs("variant34"), "variant34")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 648, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 648, + 0 + ] }); } if (!eq(tFromJs("variant35"), "variant35")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 649, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 649, + 0 + ] }); } if (!eq(tFromJs("variant36"), "variant36")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 650, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 650, + 0 + ] }); } if (!eq(tFromJs("variant37"), "variant37")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 651, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 651, + 0 + ] }); } if (!eq(tFromJs("variant38"), "variant38")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 652, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 652, + 0 + ] }); } if (!eq(tFromJs("variant39"), "variant39")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 653, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 653, + 0 + ] }); } if (!eq(tFromJs("variant40"), "variant40")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 654, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 654, + 0 + ] }); } if (!eq(tFromJs("variant41"), "variant41")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 655, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 655, + 0 + ] }); } if (!eq(tFromJs("variant42"), "variant42")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 656, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 656, + 0 + ] }); } if (!eq(tFromJs("variant43"), "variant43")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 657, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 657, + 0 + ] }); } if (!eq(tFromJs("variant44"), "variant44")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 658, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 658, + 0 + ] }); } if (!eq(tFromJs("variant45"), "variant45")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 659, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 659, + 0 + ] }); } if (!eq(tFromJs("variant46"), "variant46")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 660, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 660, + 0 + ] }); } if (!eq(tFromJs("variant47"), "variant47")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 661, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 661, + 0 + ] }); } if (!eq(tFromJs("variant48"), "variant48")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 662, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 662, + 0 + ] }); } if (!eq(tFromJs("variant49"), "variant49")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 663, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 663, + 0 + ] }); } if (!eq(tFromJs("variant50"), "variant50")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 664, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 664, + 0 + ] }); } if (!eq(tFromJs("variant51"), "variant51")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 665, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 665, + 0 + ] }); } if (!eq(tFromJs("variant52"), "variant52")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 666, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 666, + 0 + ] }); } if (!eq(tFromJs("variant53"), "variant53")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 667, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 667, + 0 + ] }); } if (!eq(tFromJs("variant54"), "variant54")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 668, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 668, + 0 + ] }); } if (!eq(tFromJs("variant55"), "variant55")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 669, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 669, + 0 + ] }); } if (!eq(tFromJs("variant56"), "variant56")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 670, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 670, + 0 + ] }); } if (!eq(tFromJs("variant57"), "variant57")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 671, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 671, + 0 + ] }); } if (!eq(tFromJs("variant58"), "variant58")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 672, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 672, + 0 + ] }); } if (!eq(tFromJs("variant59"), "variant59")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 673, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 673, + 0 + ] }); } if (!eq(tFromJs("variant60"), "variant60")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 674, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 674, + 0 + ] }); } if (!eq(tFromJs("variant61"), "variant61")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 675, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 675, + 0 + ] }); } if (!eq(tFromJs("variant62"), "variant62")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 676, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 676, + 0 + ] }); } if (!eq(tFromJs("variant63"), "variant63")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 677, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 677, + 0 + ] }); } if (!eq(tFromJs("variant64"), "variant64")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 678, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 678, + 0 + ] }); } if (!eq(tFromJs("variant65"), "variant65")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 679, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 679, + 0 + ] }); } if (!eq(tFromJs("variant66"), "variant66")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 680, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 680, + 0 + ] }); } if (!eq(tFromJs("variant67"), "variant67")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 681, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 681, + 0 + ] }); } if (!eq(tFromJs("variant68"), "variant68")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 682, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 682, + 0 + ] }); } if (!eq(tFromJs("variant69"), "variant69")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 683, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 683, + 0 + ] }); } if (!eq(tFromJs("variant70"), "variant70")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 684, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 684, + 0 + ] }); } if (!eq(tFromJs("variant71"), "variant71")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 685, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 685, + 0 + ] }); } if (!eq(tFromJs("variant72"), "variant72")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 686, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 686, + 0 + ] }); } if (!eq(tFromJs("variant73"), "variant73")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 687, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 687, + 0 + ] }); } if (!eq(tFromJs("variant74"), "variant74")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 688, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 688, + 0 + ] }); } if (!eq(tFromJs("variant75"), "variant75")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 689, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 689, + 0 + ] }); } if (!eq(tFromJs("variant76"), "variant76")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 690, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 690, + 0 + ] }); } if (!eq(tFromJs("variant77"), "variant77")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 691, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 691, + 0 + ] }); } if (!eq(tFromJs("variant78"), "variant78")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 692, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 692, + 0 + ] }); } if (!eq(tFromJs("variant79"), "variant79")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 693, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 693, + 0 + ] }); } if (!eq(tFromJs("variant80"), "variant80")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 694, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 694, + 0 + ] }); } if (!eq(tFromJs("variant81"), "variant81")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 695, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 695, + 0 + ] }); } if (!eq(tFromJs("variant82"), "variant82")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 696, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 696, + 0 + ] }); } if (!eq(tFromJs("variant83"), "variant83")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 697, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 697, + 0 + ] }); } if (!eq(tFromJs("variant84"), "variant84")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 698, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 698, + 0 + ] }); } if (!eq(tFromJs("variant85"), "variant85")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 699, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 699, + 0 + ] }); } if (!eq(tFromJs("variant86"), "variant86")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 700, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 700, + 0 + ] }); } if (!eq(tFromJs("variant87"), "variant87")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 701, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 701, + 0 + ] }); } if (!eq(tFromJs("variant88"), "variant88")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 702, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 702, + 0 + ] }); } if (!eq(tFromJs("variant89"), "variant89")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 703, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 703, + 0 + ] }); } if (!eq(tFromJs("variant90"), "variant90")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 704, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 704, + 0 + ] }); } if (!eq(tFromJs("variant91"), "variant91")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 705, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 705, + 0 + ] }); } if (!eq(tFromJs("variant92"), "variant92")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 706, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 706, + 0 + ] }); } if (!eq(tFromJs("variant93"), "variant93")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 707, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 707, + 0 + ] }); } if (!eq(tFromJs("variant94"), "variant94")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 708, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 708, + 0 + ] }); } if (!eq(tFromJs("variant95"), "variant95")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 709, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 709, + 0 + ] }); } if (!eq(tFromJs("variant96"), "variant96")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 710, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 710, + 0 + ] }); } if (!eq(tFromJs("variant97"), "variant97")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 711, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 711, + 0 + ] }); } if (!eq(tFromJs("variant98"), "variant98")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 712, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 712, + 0 + ] }); } if (!eq(tFromJs("variant99"), "variant99")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 713, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 713, + 0 + ] }); } if (!eq(tFromJs("variant100"), "variant100")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 714, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 714, + 0 + ] }); } if (!eq(tFromJs("variant101"), "variant101")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 715, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 715, + 0 + ] }); } if (!eq(tFromJs("variant102"), "variant102")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 716, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 716, + 0 + ] }); } if (!eq(tFromJs("variant103"), "variant103")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 717, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 717, + 0 + ] }); } if (!eq(tFromJs("variant104"), "variant104")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 718, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 718, + 0 + ] }); } if (!eq(tFromJs("variant105"), "variant105")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 719, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 719, + 0 + ] }); } if (!eq(tFromJs("variant106"), "variant106")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 720, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 720, + 0 + ] }); } if (!eq(tFromJs("variant107"), "variant107")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 721, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 721, + 0 + ] }); } if (!eq(tFromJs("variant108"), "variant108")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 722, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 722, + 0 + ] }); } if (!eq(tFromJs("variant109"), "variant109")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 723, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 723, + 0 + ] }); } if (!eq(tFromJs("variant110"), "variant110")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 724, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 724, + 0 + ] }); } if (!eq(tFromJs("variant111"), "variant111")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 725, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 725, + 0 + ] }); } if (!eq(tFromJs("variant112"), "variant112")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 726, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 726, + 0 + ] }); } if (!eq(tFromJs("variant113"), "variant113")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 727, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 727, + 0 + ] }); } if (!eq(tFromJs("variant114"), "variant114")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 728, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 728, + 0 + ] }); } if (!eq(tFromJs("variant115"), "variant115")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 729, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 729, + 0 + ] }); } if (!eq(tFromJs("variant116"), "variant116")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 730, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 730, + 0 + ] }); } if (!eq(tFromJs("variant117"), "variant117")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 731, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 731, + 0 + ] }); } if (!eq(tFromJs("variant118"), "variant118")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 732, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 732, + 0 + ] }); } if (!eq(tFromJs("variant119"), "variant119")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 733, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 733, + 0 + ] }); } if (!eq(tFromJs("variant120"), "variant120")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 734, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 734, + 0 + ] }); } if (!eq(tFromJs("variant121"), "variant121")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 735, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 735, + 0 + ] }); } if (!eq(tFromJs("variant122"), "variant122")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 736, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 736, + 0 + ] }); } if (!eq(tFromJs("variant123"), "variant123")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 737, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 737, + 0 + ] }); } if (!eq(tFromJs("variant124"), "variant124")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 738, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 738, + 0 + ] }); } if (!eq(tFromJs("variant125"), "variant125")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 739, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 739, + 0 + ] }); } if (!eq(tFromJs("variant126"), "variant126")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 740, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 740, + 0 + ] }); } if (!eq(tFromJs("variant127"), "variant127")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 741, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 741, + 0 + ] }); } if (!eq(tFromJs("variant128"), "variant128")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 742, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 742, + 0 + ] }); } if (!eq(tFromJs("variant129"), "variant129")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 743, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 743, + 0 + ] }); } if (!eq(tFromJs("variant130"), "variant130")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 744, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 744, + 0 + ] }); } if (!eq(tFromJs("variant131"), "variant131")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 745, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 745, + 0 + ] }); } if (!eq(tFromJs("variant132"), "variant132")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 746, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 746, + 0 + ] }); } if (!eq(tFromJs("variant133"), "variant133")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 747, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 747, + 0 + ] }); } if (!eq(tFromJs("variant134"), "variant134")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 748, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 748, + 0 + ] }); } if (!eq(tFromJs("variant135"), "variant135")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 749, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 749, + 0 + ] }); } if (!eq(tFromJs("variant136"), "variant136")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 750, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 750, + 0 + ] }); } if (!eq(tFromJs("variant137"), "variant137")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 751, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 751, + 0 + ] }); } if (!eq(tFromJs("variant138"), "variant138")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 752, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 752, + 0 + ] }); } if (!eq(tFromJs("variant139"), "variant139")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 753, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 753, + 0 + ] }); } if (!eq(tFromJs("variant140"), "variant140")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 754, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 754, + 0 + ] }); } if (!eq(tFromJs("variant141"), "variant141")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 755, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 755, + 0 + ] }); } if (!eq(tFromJs("variant142"), "variant142")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 756, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 756, + 0 + ] }); } if (!eq(tFromJs("variant143"), "variant143")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 757, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 757, + 0 + ] }); } if (!eq(tFromJs("variant144"), "variant144")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 758, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 758, + 0 + ] }); } if (!eq(tFromJs("variant145"), "variant145")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 759, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 759, + 0 + ] }); } if (!eq(tFromJs("variant146"), "variant146")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 760, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 760, + 0 + ] }); } if (!eq(tFromJs("variant147"), "variant147")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 761, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 761, + 0 + ] }); } if (!eq(tFromJs("variant148"), "variant148")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 762, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 762, + 0 + ] }); } if (!eq(tFromJs("variant149"), "variant149")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 763, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 763, + 0 + ] }); } if (!eq(tFromJs("variant150"), "variant150")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 764, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 764, + 0 + ] }); } if (!eq(tFromJs("variant151"), "variant151")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 765, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 765, + 0 + ] }); } if (!eq(tFromJs("variant152"), "variant152")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 766, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 766, + 0 + ] }); } if (!eq(tFromJs("variant153"), "variant153")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 767, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 767, + 0 + ] }); } if (!eq(tFromJs("variant154"), "variant154")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 768, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 768, + 0 + ] }); } if (!eq(tFromJs("variant155"), "variant155")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 769, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 769, + 0 + ] }); } if (!eq(tFromJs("variant156"), "variant156")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 770, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 770, + 0 + ] }); } if (!eq(tFromJs("variant157"), "variant157")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 771, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 771, + 0 + ] }); } if (!eq(tFromJs("variant158"), "variant158")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 772, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 772, + 0 + ] }); } if (!eq(tFromJs("variant159"), "variant159")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 773, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 773, + 0 + ] }); } if (!eq(tFromJs("variant160"), "variant160")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 774, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 774, + 0 + ] }); } if (!eq(tFromJs("variant161"), "variant161")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 775, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 775, + 0 + ] }); } if (!eq(tFromJs("variant162"), "variant162")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 776, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 776, + 0 + ] }); } if (!eq(tFromJs("variant163"), "variant163")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 777, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 777, + 0 + ] }); } if (!eq(tFromJs("variant164"), "variant164")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 778, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 778, + 0 + ] }); } if (!eq(tFromJs("variant165"), "variant165")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 779, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 779, + 0 + ] }); } if (!eq(tFromJs("variant166"), "variant166")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 780, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 780, + 0 + ] }); } if (!eq(tFromJs("variant167"), "variant167")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 781, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 781, + 0 + ] }); } if (!eq(tFromJs("variant168"), "variant168")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 782, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 782, + 0 + ] }); } if (!eq(tFromJs("variant169"), "variant169")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 783, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 783, + 0 + ] }); } if (!eq(tFromJs("variant170"), "variant170")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 784, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 784, + 0 + ] }); } if (!eq(tFromJs("variant171"), "variant171")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 785, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 785, + 0 + ] }); } if (!eq(tFromJs("variant172"), "variant172")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 786, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 786, + 0 + ] }); } if (!eq(tFromJs("variant173"), "variant173")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 787, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 787, + 0 + ] }); } if (!eq(tFromJs("variant174"), "variant174")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 788, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 788, + 0 + ] }); } if (!eq(tFromJs("variant175"), "variant175")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 789, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 789, + 0 + ] }); } if (!eq(tFromJs("variant176"), "variant176")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 790, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 790, + 0 + ] }); } if (!eq(tFromJs("variant177"), "variant177")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 791, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 791, + 0 + ] }); } if (!eq(tFromJs("variant178"), "variant178")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 792, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 792, + 0 + ] }); } if (!eq(tFromJs("variant179"), "variant179")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 793, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 793, + 0 + ] }); } if (!eq(tFromJs("variant180"), "variant180")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 794, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 794, + 0 + ] }); } if (!eq(tFromJs("variant181"), "variant181")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 795, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 795, + 0 + ] }); } if (!eq(tFromJs("variant182"), "variant182")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 796, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 796, + 0 + ] }); } if (!eq(tFromJs("variant183"), "variant183")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 797, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 797, + 0 + ] }); } if (!eq(tFromJs("variant184"), "variant184")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 798, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 798, + 0 + ] }); } if (!eq(tFromJs("variant185"), "variant185")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 799, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 799, + 0 + ] }); } if (!eq(tFromJs("variant186"), "variant186")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 800, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 800, + 0 + ] }); } if (!eq(tFromJs("variant187"), "variant187")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 801, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 801, + 0 + ] }); } if (!eq(tFromJs("variant188"), "variant188")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 802, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 802, + 0 + ] }); } if (!eq(tFromJs("variant189"), "variant189")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 803, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 803, + 0 + ] }); } if (!eq(tFromJs("variant190"), "variant190")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 804, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 804, + 0 + ] }); } if (!eq(tFromJs("variant191"), "variant191")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 805, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 805, + 0 + ] }); } if (!eq(tFromJs("variant192"), "variant192")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 806, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 806, + 0 + ] }); } if (!eq(tFromJs("variant193"), "variant193")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 807, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 807, + 0 + ] }); } if (!eq(tFromJs("variant194"), "variant194")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 808, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 808, + 0 + ] }); } if (!eq(tFromJs("variant195"), "variant195")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 809, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 809, + 0 + ] }); } if (!eq(tFromJs("variant196"), "variant196")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 810, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 810, + 0 + ] }); } if (!eq(tFromJs("variant197"), "variant197")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 811, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 811, + 0 + ] }); } if (!eq(tFromJs("variant198"), "variant198")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 812, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 812, + 0 + ] }); } if (!eq(tFromJs("variant199"), "variant199")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 813, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 813, + 0 + ] }); } if (!eq(tFromJs("variant200"), "variant200")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 814, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 814, + 0 + ] }); } if (!eq(tFromJs("variant201"), "variant201")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 815, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 815, + 0 + ] }); } if (!eq(tFromJs("variant202"), "variant202")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 816, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 816, + 0 + ] }); } if (!eq(tFromJs("variant203"), "variant203")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 817, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 817, + 0 + ] }); } if (!eq(tFromJs("variant204"), "variant204")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 818, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 818, + 0 + ] }); } if (!eq(tFromJs("variant205"), "variant205")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 819, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 819, + 0 + ] }); } if (!eq(tFromJs("variant206"), "variant206")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 820, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 820, + 0 + ] }); } if (!eq(tFromJs("variant207"), "variant207")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 821, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 821, + 0 + ] }); } if (!eq(tFromJs("variant208"), "variant208")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 822, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 822, + 0 + ] }); } if (!eq(tFromJs("variant209"), "variant209")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 823, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 823, + 0 + ] }); } if (!eq(tFromJs("variant210"), "variant210")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 824, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 824, + 0 + ] }); } if (!eq(tFromJs("variant211"), "variant211")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 825, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 825, + 0 + ] }); } if (!eq(tFromJs("variant212"), "variant212")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 826, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 826, + 0 + ] }); } if (!eq(tFromJs("variant213"), "variant213")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 827, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 827, + 0 + ] }); } if (!eq(tFromJs("variant214"), "variant214")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 828, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 828, + 0 + ] }); } if (!eq(tFromJs("variant215"), "variant215")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 829, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 829, + 0 + ] }); } if (!eq(tFromJs("variant216"), "variant216")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 830, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 830, + 0 + ] }); } if (!eq(tFromJs("variant217"), "variant217")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 831, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 831, + 0 + ] }); } if (!eq(tFromJs("variant218"), "variant218")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 832, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 832, + 0 + ] }); } if (!eq(tFromJs("variant219"), "variant219")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 833, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 833, + 0 + ] }); } if (!eq(tFromJs("variant220"), "variant220")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 834, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 834, + 0 + ] }); } if (!eq(tFromJs("variant221"), "variant221")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 835, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 835, + 0 + ] }); } if (!eq(tFromJs("variant222"), "variant222")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 836, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 836, + 0 + ] }); } if (!eq(tFromJs("variant223"), "variant223")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 837, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 837, + 0 + ] }); } if (!eq(tFromJs("variant224"), "variant224")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 838, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 838, + 0 + ] }); } if (!eq(tFromJs("variant225"), "variant225")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 839, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 839, + 0 + ] }); } if (!eq(tFromJs("variant226"), "variant226")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 840, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 840, + 0 + ] }); } if (!eq(tFromJs("variant227"), "variant227")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 841, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 841, + 0 + ] }); } if (!eq(tFromJs("variant228"), "variant228")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 842, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 842, + 0 + ] }); } if (!eq(tFromJs("variant229"), "variant229")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 843, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 843, + 0 + ] }); } if (!eq(tFromJs("variant230"), "variant230")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 844, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 844, + 0 + ] }); } if (!eq(tFromJs("variant231"), "variant231")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 845, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 845, + 0 + ] }); } if (!eq(tFromJs("variant232"), "variant232")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 846, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 846, + 0 + ] }); } if (!eq(tFromJs("variant233"), "variant233")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 847, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 847, + 0 + ] }); } if (!eq(tFromJs("variant234"), "variant234")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 848, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 848, + 0 + ] }); } if (!eq(tFromJs("variant235"), "variant235")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 849, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 849, + 0 + ] }); } if (!eq(tFromJs("variant236"), "variant236")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 850, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 850, + 0 + ] }); } if (!eq(tFromJs("variant237"), "variant237")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 851, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 851, + 0 + ] }); } if (!eq(tFromJs("variant238"), "variant238")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 852, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 852, + 0 + ] }); } if (!eq(tFromJs("variant239"), "variant239")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 853, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 853, + 0 + ] }); } if (!eq(tFromJs("variant240"), "variant240")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 854, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 854, + 0 + ] }); } if (!eq(tFromJs("variant241"), "variant241")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 855, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 855, + 0 + ] }); } if (!eq(tFromJs("variant242"), "variant242")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 856, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 856, + 0 + ] }); } if (!eq(tFromJs("variant243"), "variant243")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 857, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 857, + 0 + ] }); } if (!eq(tFromJs("variant244"), "variant244")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 858, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 858, + 0 + ] }); } if (!eq(tFromJs("variant245"), "variant245")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 859, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 859, + 0 + ] }); } if (!eq(tFromJs("variant246"), "variant246")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 860, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 860, + 0 + ] }); } if (!eq(tFromJs("variant247"), "variant247")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 861, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 861, + 0 + ] }); } if (!eq(tFromJs("variant248"), "variant248")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 862, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 862, + 0 + ] }); } if (!eq(tFromJs("variant249"), "variant249")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 863, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 863, + 0 + ] }); } if (!eq(tFromJs("variant250"), "variant250")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 864, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 864, + 0 + ] }); } if (!eq(tFromJs("variant251"), "variant251")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 865, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 865, + 0 + ] }); } if (!eq(tFromJs("variant252"), "variant252")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 866, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 866, + 0 + ] }); } if (!eq(tFromJs("variant253"), "variant253")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 867, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 867, + 0 + ] }); } if (!eq(tFromJs("variant254"), "variant254")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 868, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 868, + 0 + ] }); } if (!eq(tFromJs("variant255"), "variant255")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 869, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 869, + 0 + ] }); } if (!eq(tFromJs("variant256"), "variant256")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 870, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 870, + 0 + ] }); } if (!eq(tFromJs("variant257"), "variant257")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 871, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 871, + 0 + ] }); } if (!eq(tFromJs("variant258"), "variant258")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 872, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 872, + 0 + ] }); } if (!eq(tFromJs("variant259"), "variant259")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 873, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 873, + 0 + ] }); } if (!eq(tFromJs("variant260"), "variant260")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 874, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 874, + 0 + ] }); } if (!eq(tFromJs("variant261"), "variant261")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 875, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 875, + 0 + ] }); } if (!eq(tFromJs("variant262"), "variant262")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 876, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 876, + 0 + ] }); } if (!eq(tFromJs("variant263"), "variant263")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 877, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 877, + 0 + ] }); } if (!eq(tFromJs("variant264"), "variant264")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 878, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 878, + 0 + ] }); } if (!eq(tFromJs("variant265"), "variant265")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 879, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 879, + 0 + ] }); } if (!eq(tFromJs("variant266"), "variant266")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 880, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 880, + 0 + ] }); } if (!eq(tFromJs("variant267"), "variant267")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 881, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 881, + 0 + ] }); } if (!eq(tFromJs("variant268"), "variant268")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 882, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 882, + 0 + ] }); } if (!eq(tFromJs("variant269"), "variant269")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 883, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 883, + 0 + ] }); } if (!eq(tFromJs("variant270"), "variant270")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 884, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 884, + 0 + ] }); } if (!eq(tFromJs("variant271"), "variant271")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 885, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 885, + 0 + ] }); } if (!eq(tFromJs("variant272"), "variant272")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 886, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 886, + 0 + ] }); } if (!eq(tFromJs("variant273"), "variant273")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 887, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 887, + 0 + ] }); } if (!eq(tFromJs("variant274"), "variant274")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 888, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 888, + 0 + ] }); } if (!eq(tFromJs("variant275"), "variant275")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 889, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 889, + 0 + ] }); } if (!eq(tFromJs("variant276"), "variant276")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 890, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 890, + 0 + ] }); } if (!eq(tFromJs("variant277"), "variant277")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 891, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 891, + 0 + ] }); } if (!eq(tFromJs("variant278"), "variant278")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 892, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 892, + 0 + ] }); } if (!eq(tFromJs("variant279"), "variant279")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 893, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 893, + 0 + ] }); } if (!eq(tFromJs("variant280"), "variant280")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 894, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 894, + 0 + ] }); } if (!eq(tFromJs("variant281"), "variant281")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 895, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 895, + 0 + ] }); } if (!eq(tFromJs("variant282"), "variant282")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 896, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 896, + 0 + ] }); } if (!eq(tFromJs("variant283"), "variant283")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 897, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 897, + 0 + ] }); } if (!eq(tFromJs("variant284"), "variant284")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 898, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 898, + 0 + ] }); } if (!eq(tFromJs("variant285"), "variant285")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 899, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 899, + 0 + ] }); } if (!eq(tFromJs("variant286"), "variant286")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 900, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 900, + 0 + ] }); } if (!eq(tFromJs("variant287"), "variant287")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 901, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 901, + 0 + ] }); } if (!eq(tFromJs("variant288"), "variant288")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 902, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 902, + 0 + ] }); } if (!eq(tFromJs("variant289"), "variant289")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 903, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 903, + 0 + ] }); } if (!eq(tFromJs("variant290"), "variant290")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 904, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 904, + 0 + ] }); } if (!eq(tFromJs("variant291"), "variant291")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 905, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 905, + 0 + ] }); } if (!eq(tFromJs("variant292"), "variant292")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 906, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 906, + 0 + ] }); } if (!eq(tFromJs("variant293"), "variant293")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 907, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 907, + 0 + ] }); } if (!eq(tFromJs("variant294"), "variant294")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 908, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 908, + 0 + ] }); } if (!eq(tFromJs("variant295"), "variant295")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 909, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 909, + 0 + ] }); } if (!eq(tFromJs("variant296"), "variant296")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 910, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 910, + 0 + ] }); } if (!eq(tFromJs("variant297"), "variant297")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 911, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 911, + 0 + ] }); } if (!eq(tFromJs("variant298"), "variant298")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 912, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 912, + 0 + ] }); } if (!eq(tFromJs("variant299"), "variant299")) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 913, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 913, + 0 + ] }); } if (!eq(tFromJs("xx"), undefined)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 914, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 914, + 0 + ] }); } diff --git a/jscomp/test/bs_array_test.js b/jscomp/test/bs_array_test.js index 610ef1fa8b..bb6be5c5eb 100644 --- a/jscomp/test/bs_array_test.js +++ b/jscomp/test/bs_array_test.js @@ -6,6 +6,7 @@ let Caml = require("../../lib/js/caml.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Belt_List = require("../../lib/js/belt_List.js"); let Belt_Array = require("../../lib/js/belt_Array.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -122,15 +123,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 51, + 6 + ] }); } @@ -142,15 +141,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 59, + 6 + ] }); } @@ -254,15 +251,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 116, + 2 + ] }); } let res = new Array(sx); diff --git a/jscomp/test/bs_queue_test.js b/jscomp/test/bs_queue_test.js index 23b344361b..e17e1c1848 100644 --- a/jscomp/test/bs_queue_test.js +++ b/jscomp/test/bs_queue_test.js @@ -5,6 +5,7 @@ let Mt = require("./mt.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Belt_Array = require("../../lib/js/belt_Array.js"); let Belt_MutableQueue = require("../../lib/js/belt_MutableQueue.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -43,28 +44,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 25, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 26, + 2 + ] }); } @@ -72,15 +69,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 27, + 2 + ] }); } @@ -89,15 +84,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 28, + 2 + ] }); } @@ -107,28 +100,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 29, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 30, + 2 + ] }); } @@ -137,28 +126,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 31, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 32, + 2 + ] }); } @@ -166,80 +151,68 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 33, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 34, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 35, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 36, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 37, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 38, + 2 + ] }); } @@ -250,67 +223,57 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 43, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 44, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 45, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 46, + 2 + ] }); } if (q$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 47, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 47, + 2 + ] }); } @@ -321,145 +284,123 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 52, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 53, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 54, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 55, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 56, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 57, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 58, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 59, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 60, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 61, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 62, + 2 + ] }); } @@ -476,28 +417,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 71, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 72, + 2 + ] }); } @@ -506,30 +443,26 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 73, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 75, + 2 + ] }); } @@ -557,15 +490,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 84, + 2 + ] }); } @@ -581,55 +512,47 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 85, + 2 + ] }); } if (q1.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 86, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 86, + 2 + ] }); } if (q2.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 87, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 87, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 89, + 4 + ] }); } @@ -637,15 +560,13 @@ for (let i$2 = 1; i$2 <= 10; ++i$2) { 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 92, + 4 + ] }); } @@ -658,42 +579,36 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 98, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 101, + 4 + ] }); } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 102, - 4 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 102, + 4 + ] }); } @@ -701,55 +616,47 @@ for (let i$4 = 1; i$4 <= 10; ++i$4) { 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 105, + 4 + ] }); } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 106, - 4 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 106, + 4 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 109, + 2 + ] }); } if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 110, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 110, + 2 + ] }); } @@ -769,15 +676,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 120, + 4 + ] }); } i$7.contents = i$7.contents + 1 | 0; @@ -796,108 +701,92 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 127, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 128, + 2 + ] }); } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 129, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 129, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 130, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 132, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 133, + 2 + ] }); } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 134, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 134, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 135, + 2 + ] }); } @@ -918,15 +807,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 143, + 2 + ] }); } @@ -936,82 +823,70 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 144, + 2 + ] }); } if (q2$2.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 145, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 145, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 146, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 148, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 149, + 2 + ] }); } if (q2$2.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 150, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 150, + 2 + ] }); } @@ -1021,15 +896,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 151, + 2 + ] }); } @@ -1050,41 +923,35 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 159, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 160, + 2 + ] }); } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 161, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 161, + 2 + ] }); } @@ -1094,56 +961,48 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 162, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 164, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 165, + 2 + ] }); } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 166, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 166, + 2 + ] }); } @@ -1153,15 +1012,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 167, + 2 + ] }); } @@ -1186,15 +1043,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 178, + 2 + ] }); } @@ -1204,28 +1059,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 179, + 2 + ] }); } if (q2$4.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 180, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 180, + 2 + ] }); } @@ -1235,43 +1086,37 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 181, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 183, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 184, + 2 + ] }); } @@ -1287,41 +1132,35 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 186, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 187, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 189, + 2 + ] }); } diff --git a/jscomp/test/caml_compare_test.js b/jscomp/test/caml_compare_test.js index 2ecd05a679..7f6057ab17 100644 --- a/jscomp/test/caml_compare_test.js +++ b/jscomp/test/caml_compare_test.js @@ -10,7 +10,7 @@ let function_equal_test; try { function_equal_test = Caml_obj.equal(x => x + 1 | 0, x => x + 2 | 0); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); function_equal_test = exn.RE_EXN_ID === "Invalid_argument" && exn._1 === "equal: functional value" ? true : false; } diff --git a/jscomp/test/chn_test.js b/jscomp/test/chn_test.js index 17e05c04c4..2291f40687 100644 --- a/jscomp/test/chn_test.js +++ b/jscomp/test/chn_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let $$Array = require("../../lib/js/array.js"); let Caml_string = require("../../lib/js/caml_string.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -38,15 +39,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "chn_test.res", + 18, + 16 + ] }); })); } diff --git a/jscomp/test/const_defs_test.js b/jscomp/test/const_defs_test.js index 2e2bb57544..2889c69635 100644 --- a/jscomp/test/const_defs_test.js +++ b/jscomp/test/const_defs_test.js @@ -1,15 +1,14 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let u = 3; function f() { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "hi" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "hi" }); } diff --git a/jscomp/test/custom_error_test.js b/jscomp/test/custom_error_test.js index 0e19bcac08..15a09b4744 100644 --- a/jscomp/test/custom_error_test.js +++ b/jscomp/test/custom_error_test.js @@ -9,14 +9,12 @@ function test_js_error() { try { e = JSON.parse(" {\"x\" : }"); } catch (raw_err) { - let err = Caml_js_exceptions.internalToOCamlException(raw_err); + let err = Caml_js_exceptions.internalAnyToExn(raw_err); if (err.RE_EXN_ID === Js_exn.$$Error) { console.log(err._1.stack); return; } - throw new Error(err.RE_EXN_ID, { - cause: err - }); + throw err; } return e; } @@ -25,16 +23,12 @@ function test_js_error2() { try { return JSON.parse(" {\"x\" : }"); } catch (raw_e) { - let e = Caml_js_exceptions.internalToOCamlException(raw_e); + let e = Caml_js_exceptions.internalAnyToExn(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; } } @@ -43,14 +37,12 @@ function example1() { try { v = JSON.parse(" {\"x\" }"); } catch (raw_err) { - let err = Caml_js_exceptions.internalToOCamlException(raw_err); + let err = Caml_js_exceptions.internalAnyToExn(raw_err); if (err.RE_EXN_ID === Js_exn.$$Error) { console.log(err._1.stack); return; } - throw new Error(err.RE_EXN_ID, { - cause: err - }); + throw err; } return v; } @@ -59,13 +51,11 @@ function example2() { try { return JSON.parse(" {\"x\"}"); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..7641e17bc7 100644 --- a/jscomp/test/defunctor_make_test.js +++ b/jscomp/test/defunctor_make_test.js @@ -2,6 +2,7 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function getcompare(x) { return x; @@ -44,11 +45,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l._3; @@ -61,11 +60,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -79,11 +76,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r._3; @@ -96,11 +91,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } diff --git a/jscomp/test/demo_int_map.js b/jscomp/test/demo_int_map.js index 50052476dc..96bb38988a 100644 --- a/jscomp/test/demo_int_map.js +++ b/jscomp/test/demo_int_map.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -30,11 +31,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -47,11 +46,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -65,11 +62,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -82,11 +77,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -140,11 +133,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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..2cc3075c2b 100644 --- a/jscomp/test/earger_curry_test.js +++ b/jscomp/test/earger_curry_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Pervasives = require("../../lib/js/pervasives.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function map(f, a) { let f$1 = x => f(x); @@ -24,11 +25,9 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.init" }); } let res = Caml_array.make(l, f$1(0)); diff --git a/jscomp/test/equal_exception_test.js b/jscomp/test/equal_exception_test.js index 263778a862..b317364d96 100644 --- a/jscomp/test/equal_exception_test.js +++ b/jscomp/test/equal_exception_test.js @@ -13,110 +13,86 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 4, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 5, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Assert_failure", _1: [ "equal_exception_test.res", - 9, + 8, 2 ] - } + }); + } + if (Caml_string.get(v, 0) === /* 'g' */103) { + return; + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 9, + 2 + ] }); } function is_exception() { try { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } function is_normal_exception(_x) { let A = /* @__PURE__ */Caml_exceptions.create("A"); - let v = { + let v = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: A, _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); + let exn = Caml_js_exceptions.internalAnyToExn(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 Caml_js_exceptions.internalMakeExn(A); } catch (exn) { return; } @@ -152,9 +128,7 @@ let suites = { tl: suites_1 }; -let e = { - RE_EXN_ID: "Not_found" -}; +let e = Caml_js_exceptions.internalMakeExn("Not_found"); function eq(x) { return x.RE_EXN_ID === "Not_found"; @@ -162,31 +136,25 @@ function eq(x) { let Not_found = /* @__PURE__ */Caml_exceptions.create("Equal_exception_test.Not_found"); -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 - ] - } +if (Caml_obj.equal(e, Caml_js_exceptions.internalMakeExn(Not_found)) !== false) { + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 50, + 0 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 51, + 0 + ] }); } diff --git a/jscomp/test/exception_alias.js b/jscomp/test/exception_alias.js index da3b52db8c..0da5cb44a4 100644 --- a/jscomp/test/exception_alias.js +++ b/jscomp/test/exception_alias.js @@ -2,10 +2,9 @@ 'use strict'; let List = require("../../lib/js/list.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); -let a0 = { - RE_EXN_ID: "Not_found" -}; +let a0 = Caml_js_exceptions.internalMakeExn("Not_found"); let b = List.length({ hd: 1, diff --git a/jscomp/test/exception_raise_test.js b/jscomp/test/exception_raise_test.js index e847b09f39..fbe30b32bd 100644 --- a/jscomp/test/exception_raise_test.js +++ b/jscomp/test/exception_raise_test.js @@ -20,7 +20,7 @@ function appf(g, x) { try { return g(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Local) { return 3; } @@ -63,7 +63,7 @@ let f; try { f = (function () {throw (new Error ("x"))} ()); } catch (raw_x) { - let x = Caml_js_exceptions.internalToOCamlException(raw_x); + let x = Caml_js_exceptions.internalAnyToExn(raw_x); f = x.RE_EXN_ID === A ? x._1 : 2; } @@ -72,7 +72,7 @@ let ff; try { ff = (function () {throw 3} ()); } catch (raw_x$1) { - let x$1 = Caml_js_exceptions.internalToOCamlException(raw_x$1); + let x$1 = Caml_js_exceptions.internalAnyToExn(raw_x$1); ff = x$1.RE_EXN_ID === A ? x$1._1 : 2; } @@ -81,7 +81,7 @@ let fff; try { fff = (function () {throw 2} ()); } catch (raw_x$2) { - let x$2 = Caml_js_exceptions.internalToOCamlException(raw_x$2); + let x$2 = Caml_js_exceptions.internalAnyToExn(raw_x$2); fff = x$2.RE_EXN_ID === A ? x$2._1 : 2; } @@ -90,19 +90,17 @@ let a0; try { a0 = (function (){throw 2} ()); } catch (raw_x$3) { - let x$3 = Caml_js_exceptions.internalToOCamlException(raw_x$3); + let x$3 = Caml_js_exceptions.internalAnyToExn(raw_x$3); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_raise_test.res", + 104, + 7 + ] }); } } @@ -112,7 +110,7 @@ let a1; try { a1 = (function (){throw 2} ()); } catch (raw_e) { - a1 = Caml_js_exceptions.internalToOCamlException(raw_e); + a1 = Caml_js_exceptions.internalAnyToExn(raw_e); } let a2; @@ -120,7 +118,7 @@ let a2; try { a2 = (function (){throw (new Error("x"))} ()); } catch (raw_e$1) { - a2 = Caml_js_exceptions.internalToOCamlException(raw_e$1); + a2 = Caml_js_exceptions.internalAnyToExn(raw_e$1); } let suites = { @@ -154,15 +152,13 @@ let suites = { _1: 2 }; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_raise_test.res", - 127, - 15 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_raise_test.res", + 127, + 15 + ] }); } ], @@ -182,18 +178,14 @@ function eq(loc, x, y) { try { ((()=>{throw 2})()); } catch (raw_e$2) { - let e = Caml_js_exceptions.internalToOCamlException(raw_e$2); + let e = Caml_js_exceptions.internalAnyToExn(raw_e$2); eq("File \"exception_raise_test.res\", line 137, characters 10-17", Caml_js_exceptions.as_js_exn(e) !== undefined, true); } try { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } catch (raw_e$3) { - let e$1 = Caml_js_exceptions.internalToOCamlException(raw_e$3); + let e$1 = Caml_js_exceptions.internalAnyToExn(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..f74eb7d951 100644 --- a/jscomp/test/exception_rebound_err_test.js +++ b/jscomp/test/exception_rebound_err_test.js @@ -39,7 +39,7 @@ function test_js_error4() { JSON.parse(" {\"x\"}"); return 1; } catch (raw_e) { - let e = Caml_js_exceptions.internalToOCamlException(raw_e); + let e = Caml_js_exceptions.internalAnyToExn(raw_e); if (e.RE_EXN_ID === "Not_found") { return 2; } @@ -66,13 +66,11 @@ function f(g) { try { return g(); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..510b780f5e 100644 --- a/jscomp/test/exception_value_test.js +++ b/jscomp/test/exception_value_test.js @@ -6,35 +6,25 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_value_test.res", + 4, + 11 + ] }); } return 3; } function hh() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let A = /* @__PURE__ */Caml_exceptions.create("Exception_value_test.A"); @@ -43,22 +33,20 @@ let B = /* @__PURE__ */Caml_exceptions.create("Exception_value_test.B"); let C = /* @__PURE__ */Caml_exceptions.create("Exception_value_test.C"); -let u = { +let u = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: A, _1: 3 -}; +}); function test_not_found(f, param) { try { return f(); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return 2; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -66,16 +54,12 @@ function test_js_error2() { try { return JSON.parse(" {\"x\" : }"); } catch (raw_e) { - let e = Caml_js_exceptions.internalToOCamlException(raw_e); + let e = Caml_js_exceptions.internalAnyToExn(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..2b7ac58208 100644 --- a/jscomp/test/ext_array_test.js +++ b/jscomp/test/ext_array_test.js @@ -5,6 +5,7 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function reverse_range(a, i, len) { if (len === 0) { @@ -105,11 +106,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.range" }); } return $$Array.init((to_ - from | 0) + 1 | 0, i => i + from | 0); @@ -118,11 +117,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_array_test.map2i" }); } 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..c0b3185d7d 100644 --- a/jscomp/test/ext_bytes_test.js +++ b/jscomp/test/ext_bytes_test.js @@ -134,23 +134,17 @@ 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 Caml_js_exceptions.internalMakeExn(H); } } return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..7ff993cf47 100644 --- a/jscomp/test/ext_filename_test.js +++ b/jscomp/test/ext_filename_test.js @@ -58,19 +58,15 @@ function chop_extension(locOpt, name) { try { return Filename.chop_extension(name); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -78,13 +74,11 @@ function chop_extension_if_any(fname) { try { return Filename.chop_extension(fname); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Invalid_argument") { return fname; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -142,11 +136,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: s }); } let curr_char = file2.codePointAt(i); @@ -172,11 +164,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: s }); }; } @@ -344,11 +334,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: s }); } diff --git a/jscomp/test/ext_list_test.js b/jscomp/test/ext_list_test.js index 5c17bb62a0..6daf29f77e 100644 --- a/jscomp/test/ext_list_test.js +++ b/jscomp/test/ext_list_test.js @@ -5,6 +5,7 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let Caml_option = require("../../lib/js/caml_option.js"); let Ext_string_test = require("./ext_string_test.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function filter_map(f, _xs) { while (true) { @@ -203,21 +204,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2" }); } if (!ys) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.filter_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2" }); }; } @@ -244,21 +241,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2i" }); } if (!ys) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.filter_map2i" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.filter_map2i" }); }; }; @@ -296,19 +289,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.flat_map2" }); } if (ly$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.flat_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.flat_map2" }); } return List.rev(acc); @@ -350,11 +339,9 @@ function map2_last(f, l1, l2) { } } else { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2_last" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2_last" }); } } @@ -365,21 +352,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2_last" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2_last" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2_last" }); } @@ -413,30 +396,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } return accu; @@ -450,11 +427,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.take" }); } return [ @@ -539,11 +514,9 @@ function exclude_tail(x) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.exclude_tail" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.exclude_tail" }); }; } @@ -593,22 +566,18 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.drop" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.drop" }); } _h = List.tl(h); @@ -774,11 +743,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.reduce" }); } @@ -786,11 +753,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.reduce_from_left" }); } @@ -805,11 +770,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.ref_top" }); } @@ -835,11 +798,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.ref_pop" }); } @@ -865,11 +826,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.rev_except_last" }); }; } @@ -891,11 +850,9 @@ function last(_xs) { _xs = tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Ext_list_test.last" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_list_test.last" }); }; } @@ -914,15 +871,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "ext_list_test.res", + 472, + 14 + ] }); }; } @@ -941,15 +896,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "ext_list_test.res", + 487, + 14 + ] }); }; } diff --git a/jscomp/test/ext_pervasives_test.js b/jscomp/test/ext_pervasives_test.js index 5527fdf735..1d4b59cdf3 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,14 @@ function is_pos_pow(n) { _c = c + 1 | 0; continue; } - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw Caml_js_exceptions.internalMakeExn(E); }; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === E) { return -1; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -74,20 +66,14 @@ function is_pos_pow_2(n) { _c = c + 1 | 0; continue; } - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw Caml_js_exceptions.internalMakeExn(E); }; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(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..7ec5719edd 100644 --- a/jscomp/test/ext_string_test.js +++ b/jscomp/test/ext_string_test.js @@ -213,11 +213,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.for_all_range" }); } return unsafe_for_all_range(s, start, finish, p); @@ -269,23 +267,17 @@ 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 Caml_js_exceptions.internalMakeExn(Local_exit); } i = i + 1 | 0; }; return -1; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Local_exit) { return i; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -296,11 +288,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.non_overlap_count" }); } let _acc = 0; @@ -324,23 +314,17 @@ 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 Caml_js_exceptions.internalMakeExn(Local_exit); } i = i - 1 | 0; }; return -1; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Local_exit) { return i; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -350,11 +334,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s$1 }); } @@ -548,11 +530,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Ext_string_test.no_char" }); } 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..bfb35be7ab 100644 --- a/jscomp/test/extensible_variant_test.js +++ b/jscomp/test/extensible_variant_test.js @@ -3,6 +3,7 @@ let Mt = require("./mt.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let Str = /* @__PURE__ */Caml_exceptions.create("Extensible_variant_test.Str"); @@ -24,15 +25,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "extensible_variant_test.res", + 16, + 9 + ] }); } diff --git a/jscomp/test/flexible_array_test.js b/jscomp/test/flexible_array_test.js index 7e932c4ae9..c573e58288 100644 --- a/jscomp/test/flexible_array_test.js +++ b/jscomp/test/flexible_array_test.js @@ -4,17 +4,14 @@ let $$Array = require("../../lib/js/array.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_array = require("../../lib/js/caml_array.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function sub(_tr, _k) { while (true) { let k = _k; let tr = _tr; if (typeof tr !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } if (k === 1) { return tr._0; @@ -40,11 +37,7 @@ function update(tr, k, w) { _2: "Lf" }; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = tr._2; let l = tr._1; @@ -76,11 +69,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (n === 1) { return "Lf"; @@ -125,11 +114,7 @@ function loext(tr, w) { function lorem(tr) { if (typeof tr !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = tr._1; if (typeof l === "object") { @@ -144,15 +129,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "flexible_array_test.res", + 80, + 9 + ] }); } @@ -169,11 +152,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.get" }); } @@ -185,11 +166,9 @@ function set(param, i, v) { k ]; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.set" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.set" }); } @@ -208,11 +187,9 @@ function pop_front(param) { k - 1 | 0 ]; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.pop_front" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.pop_front" }); } @@ -232,11 +209,9 @@ function pop_back(param) { k - 1 | 0 ]; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.pop_back" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.pop_back" }); } @@ -319,15 +294,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "flexible_array_test.res", + 184, + 2 + ] }); } diff --git a/jscomp/test/format_regression.js b/jscomp/test/format_regression.js index c89043c8cd..e99207542c 100644 --- a/jscomp/test/format_regression.js +++ b/jscomp/test/format_regression.js @@ -1,56 +1,49 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function peek_queue(param) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 10, - 22 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 10, + 22 + ] }); } function int_of_size(param) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 11, - 23 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 11, + 23 + ] }); } function take_queue(param) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 12, - 22 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 12, + 22 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 13, + 35 + ] }); } diff --git a/jscomp/test/fun_pattern_match.js b/jscomp/test/fun_pattern_match.js index e2cab8232f..ea9a2bf879 100644 --- a/jscomp/test/fun_pattern_match.js +++ b/jscomp/test/fun_pattern_match.js @@ -2,6 +2,7 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(param, v) { return ((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + v | 0; @@ -22,15 +23,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 33, + 9 + ] }); } @@ -45,15 +44,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 39, + 9 + ] }); } diff --git a/jscomp/test/genlex_test.js b/jscomp/test/genlex_test.js index 7aa4e74b15..5d08146b9f 100644 --- a/jscomp/test/genlex_test.js +++ b/jscomp/test/genlex_test.js @@ -41,13 +41,11 @@ function to_list(s) { try { v = Stream.next(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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/global_exception_regression_test.js b/jscomp/test/global_exception_regression_test.js index a659c2d3fb..a6f6712ada 100644 --- a/jscomp/test/global_exception_regression_test.js +++ b/jscomp/test/global_exception_regression_test.js @@ -2,18 +2,13 @@ 'use strict'; let Mt = require("./mt.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); -let v = { - RE_EXN_ID: "Not_found" -}; +let v = Caml_js_exceptions.internalMakeExn("Not_found"); -let u = { - RE_EXN_ID: "Not_found" -}; +let u = Caml_js_exceptions.internalMakeExn("Not_found"); -let s = { - RE_EXN_ID: "End_of_file" -}; +let s = Caml_js_exceptions.internalMakeExn("End_of_file"); let suites_0 = [ "not_found_equal", diff --git a/jscomp/test/gpr_1150.js b/jscomp/test/gpr_1150.js index d8286103da..dcc787d26d 100644 --- a/jscomp/test/gpr_1150.js +++ b/jscomp/test/gpr_1150.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(children) { if (!children) { @@ -215,15 +216,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1150.res", + 100, + 62 + ] }); } return [ diff --git a/jscomp/test/gpr_1245_test.js b/jscomp/test/gpr_1245_test.js index e1e0e9044b..e5029a35a6 100644 --- a/jscomp/test/gpr_1245_test.js +++ b/jscomp/test/gpr_1245_test.js @@ -42,13 +42,11 @@ function a1(f) { try { return f(); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(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/gpr_1698_test.js b/jscomp/test/gpr_1698_test.js index 70186a2079..91b77d9278 100644 --- a/jscomp/test/gpr_1698_test.js +++ b/jscomp/test/gpr_1698_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function is_number(_expr) { while (true) { @@ -48,15 +49,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1698_test.res", + 41, + 9 + ] }); case "Pow" : case "Gcd" : @@ -74,15 +73,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1698_test.res", + 41, + 9 + ] }); case "Neg" : exit$3 = 5; diff --git a/jscomp/test/gpr_1701_test.js b/jscomp/test/gpr_1701_test.js index dbf9f7c67a..1eaf65dc39 100644 --- a/jscomp/test/gpr_1701_test.js +++ b/jscomp/test/gpr_1701_test.js @@ -9,22 +9,16 @@ 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 Caml_js_exceptions.internalMakeExn(Foo); } try { return test(n - 1 | 0); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Foo) { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -38,13 +32,11 @@ function read_lines(inc) { try { l = input_line(inc); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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) { @@ -66,13 +58,11 @@ function read_lines2(inc) { try { l = input_line(inc); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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, @@ -91,13 +81,11 @@ function read_lines3(inc) { tl: acc }); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..d5e3c97bf7 100644 --- a/jscomp/test/gpr_2316_test.js +++ b/jscomp/test/gpr_2316_test.js @@ -30,20 +30,16 @@ function eq(loc, x, y) { let y; try { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "boo" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "boo" }); } catch (raw_msg) { - let msg = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg = Caml_js_exceptions.internalAnyToExn(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 +48,16 @@ let x; let exit = 0; try { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "boo" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "boo" }); } catch (raw_msg$1) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg$1); + let msg$1 = Caml_js_exceptions.internalAnyToExn(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..4600da661e 100644 --- a/jscomp/test/gpr_2682_test.js +++ b/jscomp/test/gpr_2682_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let sum = ((a,b) => a + b); @@ -46,15 +47,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_2682_test.res", + 52, + 0 + ] }); } diff --git a/jscomp/test/gpr_3877_test.js b/jscomp/test/gpr_3877_test.js index 2e8759406b..dff00bcd59 100644 --- a/jscomp/test/gpr_3877_test.js +++ b/jscomp/test/gpr_3877_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function test(code) { if (code > 599 || code < 500) { @@ -21,28 +22,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3877_test.res", + 26, + 0 + ] }); } if (b !== "bad response") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3877_test.res", - 27, - 0 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3877_test.res", + 27, + 0 + ] }); } diff --git a/jscomp/test/gpr_3980_test.js b/jscomp/test/gpr_3980_test.js index 3509224e47..d285795226 100644 --- a/jscomp/test/gpr_3980_test.js +++ b/jscomp/test/gpr_3980_test.js @@ -2,49 +2,44 @@ 'use strict'; let Js_math = require("../../lib/js/js_math.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 15, + 7 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 13, + 9 + ] }); } Js_math.floor(1); } } else { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 15, - 7 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 15, + 7 + ] }); } diff --git a/jscomp/test/gpr_405_test.js b/jscomp/test/gpr_405_test.js index 3c406084b4..5d3708671f 100644 --- a/jscomp/test/gpr_405_test.js +++ b/jscomp/test/gpr_405_test.js @@ -15,13 +15,11 @@ function Make(funarg) { try { return H.find(htbl, x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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,27 +35,23 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_405_test.res", + 40, + 6 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_405_test.res", + 41, + 6 + ] }); } H.add(on_the_stack, top, true); @@ -96,11 +90,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Graph.Mincut: graph not reducible" }); } if (!rest_of_stack$1) { diff --git a/jscomp/test/gpr_4632.js b/jscomp/test/gpr_4632.js index ec0408651d..80019789b0 100644 --- a/jscomp/test/gpr_4632.js +++ b/jscomp/test/gpr_4632.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let T0_myList = { hd: 1, @@ -21,15 +22,13 @@ let T0 = { tail: T0_tail }; -throw new Error("Match_failure", { - cause: { - RE_EXN_ID: "Match_failure", - _1: [ - "gpr_4632.res", - 12, - 6 - ] - } +throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Match_failure", + _1: [ + "gpr_4632.res", + 12, + 6 + ] }); exports.T0 = T0; diff --git a/jscomp/test/gpr_5557.js b/jscomp/test/gpr_5557.js index 0ca3201b67..7ec0708121 100644 --- a/jscomp/test/gpr_5557.js +++ b/jscomp/test/gpr_5557.js @@ -1,20 +1,19 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Match_failure", + _1: [ + "gpr_5557.res", + 5, + 2 + ] }); } diff --git a/jscomp/test/gpr_858_unit2_test.js b/jscomp/test/gpr_858_unit2_test.js index 8485cff5a8..6b61ad39b4 100644 --- a/jscomp/test/gpr_858_unit2_test.js +++ b/jscomp/test/gpr_858_unit2_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let delayed = { contents: () => {} @@ -19,15 +20,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_858_unit2_test.res", + 6, + 13 + ] }); }; f(0, i); diff --git a/jscomp/test/gpr_974_test.js b/jscomp/test/gpr_974_test.js index 0c7ede290d..34e59ffbc9 100644 --- a/jscomp/test/gpr_974_test.js +++ b/jscomp/test/gpr_974_test.js @@ -3,43 +3,38 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 2, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 3, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 4, + 2 + ] }); } diff --git a/jscomp/test/inline_map2_test.js b/jscomp/test/inline_map2_test.js index f9d8d4da7c..05941eb85e 100644 --- a/jscomp/test/inline_map2_test.js +++ b/jscomp/test/inline_map2_test.js @@ -5,6 +5,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function Make(Ord) { let height = x => { @@ -41,11 +42,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l._3; @@ -58,11 +57,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -76,11 +73,9 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r._3; @@ -93,11 +88,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = x => { @@ -142,11 +135,7 @@ function Make(Ord) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Ord.compare(x, x_._1); if (c === 0) { @@ -174,11 +163,7 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = x._0; if (typeof l !== "object") { @@ -195,11 +180,7 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = x._3; if (typeof r !== "object") { @@ -214,11 +195,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = x._0; @@ -439,15 +418,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ] }); } let v2 = s2._1; @@ -675,11 +652,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l._3; @@ -692,11 +667,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -710,11 +683,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r._3; @@ -727,11 +698,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -779,11 +748,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.int_compare(x, x_._1); if (c === 0) { @@ -813,11 +778,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = x._0; if (typeof l !== "object") { @@ -835,11 +796,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = x._3; if (typeof r !== "object") { @@ -855,11 +812,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = x._0; @@ -1094,15 +1049,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ] }); } let v2 = s2._1; @@ -1366,11 +1319,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l._3; @@ -1383,11 +1334,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -1401,11 +1350,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r._3; @@ -1418,11 +1365,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -1470,11 +1415,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.string_compare(x, x_._1); if (c === 0) { @@ -1504,11 +1445,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = x._0; if (typeof l !== "object") { @@ -1526,11 +1463,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = x._3; if (typeof r !== "object") { @@ -1546,11 +1479,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = x._0; @@ -1785,15 +1716,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ] }); } let v2 = s2._1; diff --git a/jscomp/test/inline_map_demo.js b/jscomp/test/inline_map_demo.js index 10ebfd5494..247d751f0a 100644 --- a/jscomp/test/inline_map_demo.js +++ b/jscomp/test/inline_map_demo.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(x) { if (typeof x !== "object") { @@ -33,15 +34,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 41, + 15 + ] }); } let lr = l._3; @@ -54,15 +53,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 47, + 19 + ] }); } if (hr <= (hl + 2 | 0)) { @@ -76,15 +73,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 55, + 15 + ] }); } let rr = r._3; @@ -97,15 +92,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 61, + 19 + ] }); } @@ -171,11 +164,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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..32ab19a7ec 100644 --- a/jscomp/test/inline_map_test.js +++ b/jscomp/test/inline_map_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(x) { if (typeof x !== "object") { @@ -33,11 +34,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l._3; @@ -50,11 +49,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -68,11 +65,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r._3; @@ -85,11 +80,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -129,11 +122,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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..4b34b46b5a 100644 --- a/jscomp/test/inline_record_test.js +++ b/jscomp/test/inline_record_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -63,15 +64,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 47, + 9 + ] }); } @@ -107,15 +106,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 74, + 9 + ] }); } @@ -124,15 +121,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 83, + 9 + ] }); } @@ -142,12 +137,12 @@ eq("File \"inline_record_test.res\", line 80, characters 2-9", tmp$2, 22); let A4 = /* @__PURE__ */Caml_exceptions.create("Inline_record_test.A4"); -let v6 = { +let v6 = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: A4, x: 0, y: 0, z: 0 -}; +}); function ff0(x) { if (x.RE_EXN_ID === A4) { @@ -167,15 +162,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 108, + 9 + ] }); } diff --git a/jscomp/test/int64_string_test.js b/jscomp/test/int64_string_test.js index c1ce0329b6..78b1e8b9e0 100644 --- a/jscomp/test/int64_string_test.js +++ b/jscomp/test/int64_string_test.js @@ -5,6 +5,7 @@ let Mt = require("./mt.js"); let Int64 = require("../../lib/js/int64.js"); let Belt_List = require("../../lib/js/belt_List.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -1307,29 +1308,25 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "int64_string_test.res", + 191, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "int64_string_test.res", + 191, + 9 + ] }); }); diff --git a/jscomp/test/int_map.js b/jscomp/test/int_map.js index 25b7da89be..536215bb9d 100644 --- a/jscomp/test/int_map.js +++ b/jscomp/test/int_map.js @@ -3,6 +3,7 @@ let Caml = require("../../lib/js/caml.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -43,11 +44,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -60,11 +59,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -78,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -95,11 +90,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -161,11 +154,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -180,11 +169,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -258,11 +243,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -366,11 +347,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -406,11 +383,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -444,11 +417,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -753,15 +724,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/jscomp/test/internal_unused_test.js b/jscomp/test/internal_unused_test.js index 006038bf8a..461b68bb5f 100644 --- a/jscomp/test/internal_unused_test.js +++ b/jscomp/test/internal_unused_test.js @@ -2,17 +2,14 @@ 'use strict'; let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); 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 Caml_js_exceptions.internalMakeExn(A); } let c = 5; diff --git a/jscomp/test/js_exception_catch_test.js b/jscomp/test/js_exception_catch_test.js index f4580b614a..8be2a4c85c 100644 --- a/jscomp/test/js_exception_catch_test.js +++ b/jscomp/test/js_exception_catch_test.js @@ -56,16 +56,14 @@ try { e = JSON.parse(" {\"x\"}"); exit = 1; } catch (raw_x) { - let x = Caml_js_exceptions.internalToOCamlException(raw_x); + let x = Caml_js_exceptions.internalAnyToExn(raw_x); if (x.RE_EXN_ID === Js_exn.$$Error) { add_test("File \"js_exception_catch_test.res\", line 18, characters 37-44", () => ({ TAG: "Ok", _0: true })); } else { - throw new Error(x.RE_EXN_ID, { - cause: x - }); + throw x; } } @@ -87,7 +85,7 @@ function test(f) { f(); return "No_error"; } catch (raw_e) { - let e = Caml_js_exceptions.internalToOCamlException(raw_e); + let e = Caml_js_exceptions.internalAnyToExn(raw_e); if (e.RE_EXN_ID === "Not_found") { return "Not_found"; } else if (e.RE_EXN_ID === "Invalid_argument") { @@ -121,89 +119,65 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "x" }); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "" }); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: A, + _1: 2 }); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: A, + _1: 3 }); }), "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 Caml_js_exceptions.internalMakeExn(B); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: C, + _1: 1, + _2: 2 }); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: C, + _1: 0, + _2: 2 }); }), "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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "x" }); }), "Any"); diff --git a/jscomp/test/js_json_test.js b/jscomp/test/js_json_test.js index e0959fb9ca..9ab6eb6ae0 100644 --- a/jscomp/test/js_json_test.js +++ b/jscomp/test/js_json_test.js @@ -9,6 +9,7 @@ let Belt_List = require("../../lib/js/belt_List.js"); let Belt_Array = require("../../lib/js/belt_Array.js"); let Caml_array = require("../../lib/js/caml_array.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -91,29 +92,25 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Assert_failure", _1: [ "js_json_test.res", 38, 21 ] - } + }); + } + if (ty3.TAG === "JSONNumber") { + return; + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 38, + 21 + ] }); }); return { @@ -235,15 +232,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 113, + 12 + ] }); } diff --git a/jscomp/test/large_record_duplication_test.js b/jscomp/test/large_record_duplication_test.js index bee19e3350..1609c2434a 100644 --- a/jscomp/test/large_record_duplication_test.js +++ b/jscomp/test/large_record_duplication_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -27,35 +28,33 @@ let Small = /* @__PURE__ */Caml_exceptions.create("Large_record_duplication_test function f_small(x) { if (x.RE_EXN_ID === Small) { - return { + return Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Small, x: 2, y: x.y - }; + }); } else { - return { - RE_EXN_ID: "Not_found" - }; + return Caml_js_exceptions.internalMakeExn("Not_found"); } } -let h = { +let h = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Small, x: 1, y: "" -}; +}); -eq("File \"large_record_duplication_test.res\", line 70, characters 3-10", f_small(h), { +eq("File \"large_record_duplication_test.res\", line 70, characters 3-10", f_small(h), Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Small, x: 2, y: "" -}); +})); -eq("File \"large_record_duplication_test.res\", line 72, characters 3-10", Caml_obj.equal(h, { +eq("File \"large_record_duplication_test.res\", line 72, characters 3-10", Caml_obj.equal(h, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Small, x: 2, y: "" -}), false); +})), false); let v1 = { TAG: "A0", @@ -166,7 +165,7 @@ function get_x0$2(x) { } -let v3 = { +let v3 = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: A0, x0: 9, x1: 9, @@ -191,15 +190,13 @@ let v3 = { x20: 9, x21: 9, x22: 9 -}; +}); eq("File \"large_record_duplication_test.res\", line 275, characters 3-10", get_x0$2(f3(v3)), 1); eq("File \"large_record_duplication_test.res\", line 276, characters 3-10", get_x0$2(v3), 9); -eq("File \"large_record_duplication_test.res\", line 277, characters 3-10", get_x0$2({ - RE_EXN_ID: "Not_found" -}), undefined); +eq("File \"large_record_duplication_test.res\", line 277, characters 3-10", get_x0$2(Caml_js_exceptions.internalMakeExn("Not_found")), undefined); Mt.from_pair_suites("Large_record_duplication_test", suites.contents); diff --git a/jscomp/test/lazy_test.js b/jscomp/test/lazy_test.js index 12d3c2aa67..40584bec30 100644 --- a/jscomp/test/lazy_test.js +++ b/jscomp/test/lazy_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let Lazy = require("../../lib/js/lazy.js"); let CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let u = { contents: 3 @@ -50,20 +51,12 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); }); function f$1() { console.log("hi"); - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let f008 = CamlinternalLazy.from_fun(() => f$1()); @@ -183,11 +176,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); })) }) ], diff --git a/jscomp/test/libqueue_test.js b/jscomp/test/libqueue_test.js index 693731383c..c955dd1788 100644 --- a/jscomp/test/libqueue_test.js +++ b/jscomp/test/libqueue_test.js @@ -37,13 +37,11 @@ function does_raise(f, q) { f(q); return false; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Queue.Empty) { return true; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -54,15 +52,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 30, + 2 + ] }); } @@ -72,15 +68,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 32, + 2 + ] }); } @@ -93,15 +87,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 34, + 2 + ] }); } @@ -117,15 +109,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 36, + 2 + ] }); } @@ -144,28 +134,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 38, + 2 + ] }); } if (Queue.take(q) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 39, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 39, + 2 + ] }); } @@ -179,28 +165,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 40, + 2 + ] }); } if (Queue.take(q) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 41, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 41, + 2 + ] }); } @@ -211,28 +193,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 42, + 2 + ] }); } if (Queue.take(q) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 43, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 43, + 2 + ] }); } @@ -240,54 +218,46 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 44, + 2 + ] }); } if (Queue.take(q) !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 45, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 45, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 46, + 2 + ] }); } if (!does_raise(Queue.take, q)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 47, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 47, + 2 + ] }); } @@ -300,69 +270,59 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 53, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 54, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 56, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 57, + 2 + ] }); } if (q$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 58, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 58, + 2 + ] }); } @@ -375,149 +335,127 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 64, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 66, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 68, + 2 + ] }); } if (Queue.peek(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 69, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 69, + 2 + ] }); } if (Queue.take(q$2) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 70, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 70, + 2 + ] }); } if (Queue.peek(q$2) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 71, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 71, + 2 + ] }); } if (Queue.take(q$2) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 72, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 72, + 2 + ] }); } if (Queue.peek(q$2) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 73, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 73, + 2 + ] }); } if (Queue.take(q$2) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 74, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 74, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 75, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 76, + 2 + ] }); } @@ -534,28 +472,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 85, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 86, + 2 + ] }); } @@ -564,30 +498,26 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 87, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 89, + 2 + ] }); } @@ -634,15 +564,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 98, + 2 + ] }); } @@ -677,55 +605,47 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 99, + 2 + ] }); } if (q1.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 100, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 100, + 2 + ] }); } if (q2.length !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 101, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 101, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 103, + 4 + ] }); } @@ -733,15 +653,13 @@ for (let i$2 = 1; i$2 <= 10; ++i$2) { 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 106, + 4 + ] }); } @@ -754,42 +672,36 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 112, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 115, + 4 + ] }); } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 116, - 4 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 116, + 4 + ] }); } @@ -797,55 +709,47 @@ for (let i$4 = 1; i$4 <= 10; ++i$4) { 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 119, + 4 + ] }); } if (q$4.length === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 120, - 4 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 120, + 4 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 123, + 2 + ] }); } if (q$4.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 124, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 124, + 2 + ] }); } @@ -865,15 +769,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 134, + 4 + ] }); } i$7.contents = i$7.contents + 1 | 0; @@ -892,108 +794,92 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 141, + 2 + ] }); } if (to_list(q1$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 142, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 142, + 2 + ] }); } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 143, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 143, + 2 + ] }); } if (to_list(q2$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 144, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 144, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 146, + 2 + ] }); } if (to_list(q1$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 147, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 147, + 2 + ] }); } if (q2$1.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 148, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 148, + 2 + ] }); } if (to_list(q2$1) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 149, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 149, + 2 + ] }); } @@ -1014,15 +900,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 157, + 2 + ] }); } @@ -1039,82 +923,70 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 158, + 2 + ] }); } if (q2$2.length !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 159, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 159, + 2 + ] }); } if (to_list(q2$2) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 160, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 160, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 162, + 2 + ] }); } if (to_list(q1$2) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 163, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 163, + 2 + ] }); } if (q2$2.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 164, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 164, + 2 + ] }); } @@ -1131,15 +1003,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 165, + 2 + ] }); } @@ -1160,41 +1030,35 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 173, + 2 + ] }); } if (to_list(q1$3) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 174, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 174, + 2 + ] }); } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 175, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 175, + 2 + ] }); } @@ -1211,56 +1075,48 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 176, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 178, + 2 + ] }); } if (to_list(q1$3) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 179, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 179, + 2 + ] }); } if (q2$3.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 180, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 180, + 2 + ] }); } @@ -1277,15 +1133,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 181, + 2 + ] }); } @@ -1310,15 +1164,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 192, + 2 + ] }); } @@ -1335,28 +1187,24 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 193, + 2 + ] }); } if (q2$4.length !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 194, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 194, + 2 + ] }); } @@ -1373,56 +1221,48 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 195, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 197, + 2 + ] }); } if (to_list(q1$4) !== /* [] */0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 198, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 198, + 2 + ] }); } if (q2$4.length !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "libqueue_test.res", - 199, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 199, + 2 + ] }); } @@ -1451,15 +1291,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "libqueue_test.res", + 200, + 2 + ] }); } diff --git a/jscomp/test/local_exception_test.js b/jscomp/test/local_exception_test.js index 702e86d985..a8e3b85211 100644 --- a/jscomp/test/local_exception_test.js +++ b/jscomp/test/local_exception_test.js @@ -2,27 +2,26 @@ 'use strict'; let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let A = /* @__PURE__ */Caml_exceptions.create("Local_exception_test.A"); -let v = { +let v = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: A, _1: 3, _2: true -}; +}); let B = /* @__PURE__ */Caml_exceptions.create("Local_exception_test.B"); -let u = { - RE_EXN_ID: B -}; +let u = Caml_js_exceptions.internalMakeExn(B); let D = /* @__PURE__ */Caml_exceptions.create("Local_exception_test.D"); -let d = { +let d = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: D, _1: 3 -}; +}); exports.A = A; exports.v = v; diff --git a/jscomp/test/map_find_test.js b/jscomp/test/map_find_test.js index fd645f38c2..8e0b383e7e 100644 --- a/jscomp/test/map_find_test.js +++ b/jscomp/test/map_find_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -33,11 +34,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -50,11 +49,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -68,11 +65,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -85,11 +80,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -143,11 +136,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -212,11 +201,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -229,11 +216,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -247,11 +232,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -264,11 +247,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -322,11 +303,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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..5b17f25cf3 100644 --- a/jscomp/test/map_test.js +++ b/jscomp/test/map_test.js @@ -5,6 +5,7 @@ let Mt = require("./mt.js"); let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let compare = Caml.int_compare; @@ -51,11 +52,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -68,11 +67,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -86,11 +83,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -103,11 +98,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -169,11 +162,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -188,11 +177,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -266,11 +251,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -374,11 +355,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -414,11 +391,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -452,11 +425,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -761,15 +732,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; @@ -1045,11 +1014,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -1062,11 +1029,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -1080,11 +1045,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -1097,11 +1060,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -1163,11 +1124,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.string_compare(x, param.v); if (c === 0) { @@ -1182,11 +1139,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1260,11 +1213,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1368,11 +1317,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -1408,11 +1353,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -1446,11 +1387,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -1755,15 +1694,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/jscomp/test/mario_game.js b/jscomp/test/mario_game.js index f1dc0788a9..036ea20a4e 100644 --- a/jscomp/test/mario_game.js +++ b/jscomp/test/mario_game.js @@ -8,6 +8,7 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_int32 = require("../../lib/js/caml_int32.js"); let Pervasives = require("../../lib/js/pervasives.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let Actors = {}; @@ -1484,11 +1485,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Game over." }); } @@ -1499,11 +1498,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Game over." }); } @@ -2464,11 +2461,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Shouldn't reach here" }); } } @@ -2489,11 +2484,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Shouldn't reach here" }); } } @@ -3005,11 +2998,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Shouldn't reach here" }); } } @@ -3279,11 +3270,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "fail" }); } let context = canvas.getContext("2d"); diff --git a/jscomp/test/noassert.js b/jscomp/test/noassert.js index 249a4ce2fb..5bbdd8dba0 100644 --- a/jscomp/test/noassert.js +++ b/jscomp/test/noassert.js @@ -1,17 +1,16 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f() { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "noassert.res", - 1, - 14 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "noassert.res", + 1, + 14 + ] }); } diff --git a/jscomp/test/ocaml_re_test.js b/jscomp/test/ocaml_re_test.js index 2b1ff3c81c..59e04f71a5 100644 --- a/jscomp/test/ocaml_re_test.js +++ b/jscomp/test/ocaml_re_test.js @@ -318,11 +318,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -335,11 +333,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -353,11 +349,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -370,11 +364,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -519,11 +511,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -535,11 +525,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -552,11 +540,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -568,11 +554,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } @@ -1072,15 +1056,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 815, + 16 + ] }); } }; @@ -1506,15 +1488,13 @@ function find_state(re, desc) { try { return Re_automata_State.Table.find(re.states, desc); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let st = mk_state(re.ncol, desc); Re_automata_State.Table.add(re.states, desc, st); return st; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1576,7 +1556,7 @@ function final(info, st, cat) { try { return List.assq(cat, st.final); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let st$p = delta$1(info, cat, -1, st); let res_0 = st$p.idx; @@ -1594,9 +1574,7 @@ function final(info, st, cat) { }; return res; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1604,7 +1582,7 @@ function find_initial_state(re, cat) { try { return List.assq(cat, re.initial_states); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let st = find_state(re, Re_automata_State.create(cat, re.initial)); re.initial_states = { @@ -1616,9 +1594,7 @@ function find_initial_state(re, cat) { }; return st; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1721,11 +1697,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = compare(v, param.v); if (c === 0) { @@ -1735,15 +1707,13 @@ function trans_set(cache, cm, s) { continue; }; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let l = List.fold_right((param, l) => union(seq(Caml_bytes.get(cm, param[0]), Caml_bytes.get(cm, param[1])), l), s, /* [] */0); cache.contents = add(v, l, cache.contents); return l; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -1882,15 +1852,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 2168, + 8 + ] }); } } @@ -2492,15 +2460,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 2402, + 80 + ] }); } } @@ -2535,29 +2501,25 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Assert_failure", _1: [ "ocaml_re_test.res", 2437, 11 ] - } + }); + } + if (x.TAG === "Set") { + return x._0; + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "ocaml_re_test.res", + 2437, + 11 + ] }); } @@ -2756,19 +2718,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Re.repn" }); } if (j !== undefined && j < i) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Re.repn" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Re.repn" }); } return { @@ -2798,11 +2756,9 @@ function compl(l) { if (is_charset(r)) { return r; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Re.compl" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Re.compl" }); } @@ -3153,11 +3109,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: name }); } let partial = false; @@ -3224,19 +3178,11 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let m1 = Caml_array.get(t.marks, (i << 1)); if (m1 === -1) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } 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,11 +3232,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } } @@ -3320,31 +3264,21 @@ 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 Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } } catch (exn) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } } i.contents = i.contents + len | 0; return true; } catch (raw_exn) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn); 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 +3345,18 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } return r; } if (accept(/* '#' */35)) { return comment(); } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } let r$1 = regexp$p(branch()); if (!accept(/* ')' */41)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } return { TAG: "Group", @@ -3466,11 +3388,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } let c = get(); switch (c) { @@ -3484,11 +3402,7 @@ 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 Caml_js_exceptions.internalMakeExn(Not_supported); case 65 : return "Beg_of_str"; case 66 : @@ -3593,11 +3507,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); case 122 : return "End_of_str"; default: @@ -3608,11 +3518,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } let c$1 = get(); if (c$1 >= 64) { @@ -3623,25 +3529,13 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { _0: single(c$1) }; } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } if (c$1 >= 44) { if (c$1 >= 63) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } return { TAG: "Set", @@ -3649,11 +3543,7 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } if (c$1 >= 42) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } return { TAG: "Set", @@ -3683,11 +3573,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } _i = i$p; continue; @@ -3712,18 +3598,10 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } if (j !== undefined && j < i$1) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } return greedy_mod(repn(r, i$1, j)); } @@ -3732,20 +3610,12 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } let c = get(); if (c === /* '[' */91) { if (accept(/* '=' */61)) { - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw Caml_js_exceptions.internalMakeExn(Not_supported); } if (accept(/* ':' */58)) { let compl$1 = accept(/* '^' */94); @@ -3792,24 +3662,14 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { } }); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_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 Caml_js_exceptions.internalMakeExn(Parse_error); } let posix_class = posix_class_of_string(cls); let re = compl$1 ? compl({ @@ -3828,26 +3688,14 @@ function parse(multiline, dollar_endonly, dotall, ungreedy, s) { }; } if (i.contents === l) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } let c$1 = get(); if (!accept(/* '.' */46)) { - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw Caml_js_exceptions.internalMakeExn(Not_supported); } if (!accept(/* ']' */93)) { - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error - } - }); + throw Caml_js_exceptions.internalMakeExn(Parse_error); } return { NAME: "Char", @@ -4014,19 +3862,11 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } } else { if (c$2 >= 48) { - throw new Error(Not_supported, { - cause: { - RE_EXN_ID: Not_supported - } - }); + throw Caml_js_exceptions.internalMakeExn(Not_supported); } return { NAME: "Char", @@ -4127,11 +3967,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); } return res; } @@ -4174,17 +4010,9 @@ function exec(rex, pos, s) { return substr._0; } if (substr === "Failed") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let s = "a".repeat(1048575) + "b"; diff --git a/jscomp/test/offset.js b/jscomp/test/offset.js index 478ed2bf19..2ae039dc52 100644 --- a/jscomp/test/offset.js +++ b/jscomp/test/offset.js @@ -5,6 +5,7 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); let $$String = require("../../lib/js/string.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -35,11 +36,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -51,11 +50,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -68,11 +65,9 @@ function bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -84,11 +79,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } @@ -173,11 +166,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -207,11 +196,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -239,11 +224,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -658,11 +641,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = Caml.string_compare(x, v); @@ -678,11 +657,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -744,11 +719,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -955,15 +926,13 @@ function of_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ] }); }; return sub(List.length(l$1), l$1)[0]; diff --git a/jscomp/test/pq_test.js b/jscomp/test/pq_test.js index 55344e6523..e0c8779c3b 100644 --- a/jscomp/test/pq_test.js +++ b/jscomp/test/pq_test.js @@ -2,6 +2,7 @@ 'use strict'; let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function insert(queue, prio, elt) { if (typeof queue !== "object") { @@ -40,11 +41,7 @@ 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 Caml_js_exceptions.internalMakeExn(Queue_is_empty); } let left = x._2; let tmp = x._3; @@ -84,11 +81,7 @@ function extract(x) { remove_top(x) ]; } - throw new Error(Queue_is_empty, { - cause: { - RE_EXN_ID: Queue_is_empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Queue_is_empty); } let PrioQueue = { diff --git a/jscomp/test/queue_402.js b/jscomp/test/queue_402.js index c40c62a0f9..6763c0d4ef 100644 --- a/jscomp/test/queue_402.js +++ b/jscomp/test/queue_402.js @@ -3,6 +3,7 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let Empty = /* @__PURE__ */Caml_exceptions.create("Queue_402.Empty"); @@ -40,22 +41,14 @@ function add(x, q) { function peek(q) { if (q.length === 0) { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } return q.tail.next.content; } function take(q) { if (q.length === 0) { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } 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..6fb6180d5a 100644 --- a/jscomp/test/raw_hash_tbl_bench.js +++ b/jscomp/test/raw_hash_tbl_bench.js @@ -2,6 +2,7 @@ 'use strict'; let Hashtbl = require("../../lib/js/hashtbl.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function bench() { let table = Hashtbl.create(undefined, 1000000); @@ -10,15 +11,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "raw_hash_tbl_bench.res", + 8, + 4 + ] }); } diff --git a/jscomp/test/rbset.js b/jscomp/test/rbset.js index 559c1cfe84..33fde705e9 100644 --- a/jscomp/test/rbset.js +++ b/jscomp/test/rbset.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function blackify(x) { if (typeof x !== "object" || x._0 === "Black") { @@ -265,15 +266,13 @@ function unbalanced_left(x) { } } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 64, - 9 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 64, + 9 + ] }); } @@ -335,15 +334,13 @@ function unbalanced_right(x) { } } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 75, - 9 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 75, + 9 + ] }); } @@ -560,15 +557,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 138, + 4 + ] }); } let c = x._0; @@ -597,15 +592,13 @@ function remove_min(x) { false ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "rbset.res", - 138, - 4 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "rbset.res", + 138, + 4 + ] }); } diff --git a/jscomp/test/reactDOMRe.js b/jscomp/test/reactDOMRe.js index e438f9ee76..718b1b7486 100644 --- a/jscomp/test/reactDOMRe.js +++ b/jscomp/test/reactDOMRe.js @@ -3,6 +3,7 @@ let React = require("react"); let ReactDom = require("react-dom"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function renderToElementWithClassName(reactElement, className) { let elements = document.getElementsByClassName(className); @@ -69,11 +70,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "ReactDOMRe.hydrateToElementWithId : no element of id " + (id + " found in the HTML.") }); } ReactDom.hydrate(reactElement, element); diff --git a/jscomp/test/rec_module_test.js b/jscomp/test/rec_module_test.js index eeeeb1eb4c..06a9dcfd70 100644 --- a/jscomp/test/rec_module_test.js +++ b/jscomp/test/rec_module_test.js @@ -6,6 +6,7 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); let Caml_module = require("../../lib/js/caml_module.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let A = Caml_module.init_mod([ "rec_module_test.res", @@ -214,11 +215,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -230,11 +229,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -247,11 +244,9 @@ function bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -263,11 +258,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } @@ -352,11 +345,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -386,11 +375,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -418,11 +403,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -837,11 +820,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = AAA.compare(x, v); @@ -857,11 +836,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -923,11 +898,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1134,15 +1105,13 @@ function of_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ] }); }; return sub(List.length(l$1), l$1)[0]; diff --git a/jscomp/test/recmodule.js b/jscomp/test/recmodule.js index c940c8ea14..758d2c2ab4 100644 --- a/jscomp/test/recmodule.js +++ b/jscomp/test/recmodule.js @@ -2,6 +2,7 @@ 'use strict'; let Caml_module = require("../../lib/js/caml_module.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let Entity = {}; @@ -34,15 +35,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "recmodule.res", + 60, + 41 + ] }); }; let routes = () => [[ @@ -108,15 +107,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "recmodule.res", + 60, + 41 + ] }); } diff --git a/jscomp/test/record_debug_test.js b/jscomp/test/record_debug_test.js index 5440c26437..d1cb868dfc 100644 --- a/jscomp/test/record_debug_test.js +++ b/jscomp/test/record_debug_test.js @@ -3,6 +3,7 @@ let Mt = require("./mt.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -40,10 +41,10 @@ let A = /* @__PURE__ */Caml_exceptions.create("Record_debug_test.A"); let B = /* @__PURE__ */Caml_exceptions.create("Record_debug_test.B"); -let v0 = { +let v0 = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: A, _1: 3 -}; +}); let v1 = { RE_EXN_ID: B, diff --git a/jscomp/test/record_extension_test.js b/jscomp/test/record_extension_test.js index dedeabf26c..3d1b5d7160 100644 --- a/jscomp/test/record_extension_test.js +++ b/jscomp/test/record_extension_test.js @@ -83,7 +83,7 @@ function u(f) { try { return f(); } catch (raw_x) { - let x = Caml_js_exceptions.internalToOCamlException(raw_x); + let x = Caml_js_exceptions.internalAnyToExn(raw_x); if (x.RE_EXN_ID === A) { return x.name + x.x | 0; } else if (x.RE_EXN_ID === B) { @@ -97,31 +97,25 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: A, + name: 1, + x: 1 }); }), 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: B, + _1: 1, + _2: 2 }); }), 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: C, + name: 4 }); }), 4); diff --git a/jscomp/test/recursive_module.js b/jscomp/test/recursive_module.js index 70ee5b42ee..37aa0b14f8 100644 --- a/jscomp/test/recursive_module.js +++ b/jscomp/test/recursive_module.js @@ -96,13 +96,11 @@ let tmp; try { tmp = CamlinternalLazy.force(Intb.a); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Lazy.Undefined) { tmp = -1; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -169,13 +167,11 @@ try { Int3.u(3); tmp$1 = 3; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); 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..3c8349b0a1 100644 --- a/jscomp/test/recursive_records_test.js +++ b/jscomp/test/recursive_records_test.js @@ -4,6 +4,7 @@ let Mt = require("./mt.js"); let List = require("../../lib/js/list.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let suites = { contents: /* [] */0 @@ -68,15 +69,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "recursive_records_test.res", + 49, + 11 + ] }); } diff --git a/jscomp/test/return_check.js b/jscomp/test/return_check.js index ab7805940a..07d98a1347 100644 --- a/jscomp/test/return_check.js +++ b/jscomp/test/return_check.js @@ -2,6 +2,7 @@ 'use strict'; let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function test(dom) { let elem = dom.getElementById("haha"); @@ -18,15 +19,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "return_check.res", + 23, + 12 + ] }); } @@ -60,15 +59,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "return_check.res", + 51, + 12 + ] }); } @@ -77,15 +74,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "return_check.res", + 59, + 12 + ] }); } diff --git a/jscomp/test/set_gen.js b/jscomp/test/set_gen.js index d5e26c887a..d699f01fad 100644 --- a/jscomp/test/set_gen.js +++ b/jscomp/test/set_gen.js @@ -4,6 +4,7 @@ let List = require("../../lib/js/list.js"); let Pervasives = require("../../lib/js/pervasives.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function cons_enum(_s, _e) { while (true) { @@ -35,11 +36,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = x._0; if (typeof l !== "object") { @@ -54,11 +51,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = x._2; if (typeof r !== "object") { @@ -208,19 +201,11 @@ 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 Caml_js_exceptions.internalMakeExn(Height_invariant_broken); } let diff = Pervasives.abs(hl - hr | 0); if (diff > 2) { - throw new Error(Height_diff_borken, { - cause: { - RE_EXN_ID: Height_diff_borken - } - }); + throw Caml_js_exceptions.internalMakeExn(Height_diff_borken); } return h; } @@ -250,15 +235,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 278, + 15 + ] }); } let lr = l._2; @@ -270,15 +253,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 288, + 19 + ] }); } if (hr <= (hl + 2 | 0)) { @@ -291,15 +272,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 300, + 15 + ] }); } let rr = r._2; @@ -311,25 +290,21 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 306, + 19 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = x._0; @@ -538,15 +513,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set_gen.res", + 447, + 18 + ] }); }; return sub(List.length(l), l)[0]; diff --git a/jscomp/test/sexp.js b/jscomp/test/sexp.js index 3ad3c16eae..13f0001b97 100644 --- a/jscomp/test/sexp.js +++ b/jscomp/test/sexp.js @@ -7,6 +7,7 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Pervasives = require("../../lib/js/pervasives.js"); let Caml_format = require("../../lib/js/caml_format.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let equal = Caml_obj.equal; @@ -477,11 +478,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "CCSexp.Traverse.get_exn" }); } diff --git a/jscomp/test/sexpm.js b/jscomp/test/sexpm.js index ee81d710c7..669589b16a 100644 --- a/jscomp/test/sexpm.js +++ b/jscomp/test/sexpm.js @@ -22,18 +22,10 @@ function _must_escape(s) { if (c !== 92) { exit = 1; } else { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } } else { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } } else if (c >= 11) { if (c >= 32) { @@ -50,43 +42,29 @@ function _must_escape(s) { case 34 : case 40 : case 41 : - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } } else { exit = 1; } } else { if (c >= 9) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } exit = 1; } if (exit === 1 && c > 127) { - throw new Error(Pervasives.Exit, { - cause: { - RE_EXN_ID: Pervasives.Exit - } - }); + throw Caml_js_exceptions.internalMakeExn(Pervasives.Exit); } } return false; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Pervasives.Exit) { return true; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -161,15 +139,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "sexpm.res", + 111, + 4 + ] }); } let c = Caml_bytes.get(t.buf, t.i); @@ -232,15 +208,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "sexpm.res", + 152, + 27 + ] }); case 34 : return quoted(k, t); @@ -259,15 +233,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "sexpm.res", + 152, + 27 + ] }); } Buffer.add_char(t.atom, c); diff --git a/jscomp/test/stack_comp_test.js b/jscomp/test/stack_comp_test.js index e48789bbee..0fa69e9caa 100644 --- a/jscomp/test/stack_comp_test.js +++ b/jscomp/test/stack_comp_test.js @@ -60,13 +60,11 @@ function does_raise(f, s) { f(s); return false; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..5a9991b1db 100644 --- a/jscomp/test/stream_parser_test.js +++ b/jscomp/test/stream_parser_test.js @@ -7,6 +7,7 @@ let Genlex = require("../../lib/js/genlex.js"); let Stream = require("../../lib/js/stream.js"); let Caml_int32 = require("../../lib/js/caml_int32.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let Parse_error = /* @__PURE__ */Caml_exceptions.create("Stream_parser_test.Parse_error"); @@ -40,36 +41,28 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Parse_error, _1: "Unbalanced parens" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parse_error, + _1: "Unbalanced parens" }); } Queue.push(n, look_ahead); - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "unexpected token" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parse_error, + _1: "unexpected token" }); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parse_error, + _1: "unexpected token" }); } }; @@ -173,34 +166,26 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Parse_error, _1: "Unbalanced )" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parse_error, + _1: "Unbalanced )" }); } - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "Unexpected token" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parse_error, + _1: "Unexpected token" }); case "Int" : return i._0; default: - throw new Error(Parse_error, { - cause: { - RE_EXN_ID: Parse_error, - _1: "Unexpected token" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Parse_error, + _1: "Unexpected token" }); } }; diff --git a/jscomp/test/string_set.js b/jscomp/test/string_set.js index 75578cd7f2..bd1582c6d9 100644 --- a/jscomp/test/string_set.js +++ b/jscomp/test/string_set.js @@ -6,6 +6,7 @@ let List = require("../../lib/js/list.js"); let $$Array = require("../../lib/js/array.js"); let $$String = require("../../lib/js/string.js"); let Set_gen = require("./set_gen.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function split(x, tree) { if (typeof tree !== "object") { @@ -223,11 +224,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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..4c099040aa 100644 --- a/jscomp/test/string_test.js +++ b/jscomp/test/string_test.js @@ -65,16 +65,14 @@ function rev_split_by_char(c, s) { tl: l })); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return { hd: $$String.sub(s, i, s.length - i | 0), tl: l }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; return loop(0, /* [] */0); @@ -95,16 +93,14 @@ function xsplit(delim, s) { try { i$p = $$String.rindex_from(s, x - 1 | 0, delim); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return { hd: $$String.sub(s, 0, x), 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..cf0d448103 100644 --- a/jscomp/test/stringmatch_test.js +++ b/jscomp/test/stringmatch_test.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function tst01(s) { if (s === "") { @@ -11,41 +12,35 @@ function tst01(s) { } if (tst01("") !== 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 22, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 22, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 23, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 24, + 2 + ] }); } @@ -55,27 +50,23 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 33, + 21 + ] }); } if (len === 0) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 35, - 21 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 35, + 21 + ] }); } if (s === "A") { @@ -86,67 +77,57 @@ function tst02(s) { } if (tst02("") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 42, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 42, + 2 + ] }); } if (tst02("A") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 43, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 43, + 2 + ] }); } if (tst02("B") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 44, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 44, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 45, + 2 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 46, + 2 + ] }); } @@ -206,626 +187,530 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 131, + 2 + ] }); } if (tst03("set_congt") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 132, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 132, + 2 + ] }); } if (tst03("get_var") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 133, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 133, + 2 + ] }); } if (tst03("gat_ver") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 134, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 134, + 2 + ] }); } if (tst03("get_env") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 135, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 135, + 2 + ] }); } if (tst03("get_env") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 136, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 136, + 2 + ] }); } if (tst03("get_meth") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 137, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 137, + 2 + ] }); } if (tst03("met_geth") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 138, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 138, + 2 + ] }); } if (tst03("set_var") !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 139, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 139, + 2 + ] }); } if (tst03("sev_tar") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 140, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 140, + 2 + ] }); } if (tst03("app_const") !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 141, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 141, + 2 + ] }); } if (tst03("ppa_const") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 142, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 142, + 2 + ] }); } if (tst03("app_var") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 143, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 143, + 2 + ] }); } if (tst03("app_var") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 144, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 144, + 2 + ] }); } if (tst03("app_env") !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 145, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 145, + 2 + ] }); } if (tst03("epp_anv") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 146, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 146, + 2 + ] }); } if (tst03("app_meth") !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 147, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 147, + 2 + ] }); } if (tst03("atp_meph") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 148, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 148, + 2 + ] }); } if (tst03("app_const_const") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 149, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 149, + 2 + ] }); } if (tst03("app_const_const") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 150, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 150, + 2 + ] }); } if (tst03("app_const_var") !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 151, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 151, + 2 + ] }); } if (tst03("atp_consp_var") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 152, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 152, + 2 + ] }); } if (tst03("app_const_env") !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 153, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 153, + 2 + ] }); } if (tst03("app_constne_v") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 154, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 154, + 2 + ] }); } if (tst03("app_const_meth") !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 155, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 155, + 2 + ] }); } if (tst03("spp_conat_meth") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 156, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 156, + 2 + ] }); } if (tst03("app_var_const") !== 13) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 157, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 157, + 2 + ] }); } if (tst03("app_va_rconst") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 158, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 158, + 2 + ] }); } if (tst03("app_env_const") !== 14) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 159, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 159, + 2 + ] }); } if (tst03("app_env_const") !== 14) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 160, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 160, + 2 + ] }); } if (tst03("app_meth_const") !== 15) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 161, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 161, + 2 + ] }); } if (tst03("app_teth_consm") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 162, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 162, + 2 + ] }); } if (tst03("meth_app_const") !== 16) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 163, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 163, + 2 + ] }); } if (tst03("math_epp_const") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 164, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 164, + 2 + ] }); } if (tst03("meth_app_var") !== 17) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 165, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 165, + 2 + ] }); } if (tst03("meth_app_var") !== 17) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 166, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 166, + 2 + ] }); } if (tst03("meth_app_env") !== 18) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 167, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 167, + 2 + ] }); } if (tst03("eeth_app_mnv") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 168, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 168, + 2 + ] }); } if (tst03("meth_app_meth") !== 19) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 169, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 169, + 2 + ] }); } if (tst03("meth_apt_meph") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 170, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 170, + 2 + ] }); } if (tst03("send_const") !== 20) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 171, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 171, + 2 + ] }); } if (tst03("tend_conss") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 172, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 172, + 2 + ] }); } if (tst03("send_var") !== 21) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 173, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 173, + 2 + ] }); } if (tst03("serd_van") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 174, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 174, + 2 + ] }); } if (tst03("send_env") !== 22) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 175, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 175, + 2 + ] }); } if (tst03("sen_denv") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 176, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 176, + 2 + ] }); } if (tst03("send_meth") !== 23) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 177, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 177, + 2 + ] }); } if (tst03("tend_mesh") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 178, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 178, + 2 + ] }); } @@ -861,249 +746,211 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 215, + 2 + ] }); } if (tst04("AAAAAAAAAAAAAAAA") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 216, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 216, + 2 + ] }); } if (tst04("AAAAAAAAAAAAAAAAAAAAAAAA") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 217, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 217, + 2 + ] }); } if (tst04("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 218, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 218, + 2 + ] }); } if (tst04("BBBBBBBB") !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 219, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 219, + 2 + ] }); } if (tst04("BBBBBBBBBBBBBBBB") !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 220, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 220, + 2 + ] }); } if (tst04("BBBBBBBBBBBBBBBBBBBBBBBB") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 221, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 221, + 2 + ] }); } if (tst04("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 222, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 222, + 2 + ] }); } if (tst04("CCCCCCCC") !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 223, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 223, + 2 + ] }); } if (tst04("CCCCCCCCCCCCCCCC") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 224, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 224, + 2 + ] }); } if (tst04("CCCCCCCCCCCCCCCCCCCCCCCC") !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 225, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 225, + 2 + ] }); } if (tst04("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC") !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 226, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 226, + 2 + ] }); } if (tst04("") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 227, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 227, + 2 + ] }); } if (tst04("DDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 228, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 228, + 2 + ] }); } if (tst04("DDDDDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 229, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 229, + 2 + ] }); } if (tst04("AAADDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 230, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 230, + 2 + ] }); } if (tst04("AAAAAAADDDDDDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 231, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 231, + 2 + ] }); } if (tst04("AAAAAAADDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 232, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 232, + 2 + ] }); } if (tst04("AAAAAAAAAAAAAAADDDD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 233, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 233, + 2 + ] }); } @@ -1141,288 +988,244 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 272, + 2 + ] }); } if (tst05("AAAA") !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 273, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 273, + 2 + ] }); } if (tst05("AAAAA") !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 274, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 274, + 2 + ] }); } if (tst05("AAAAAA") !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 275, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 275, + 2 + ] }); } if (tst05("AAAAAAA") !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 276, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 276, + 2 + ] }); } if (tst05("AAAAAAAAAAAA") !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 277, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 277, + 2 + ] }); } if (tst05("AAAAAAAAAAAAAAAA") !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 278, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 278, + 2 + ] }); } if (tst05("AAAAAAAAAAAAAAAAAAAA") !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 279, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 279, + 2 + ] }); } if (tst05("BBB") !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 280, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 280, + 2 + ] }); } if (tst05("BBBB") !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 281, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 281, + 2 + ] }); } if (tst05("BBBBB") !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 282, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 282, + 2 + ] }); } if (tst05("BBBBBB") !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 283, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 283, + 2 + ] }); } if (tst05("BBBBBBB") !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 284, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 284, + 2 + ] }); } if (tst05("") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 285, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 285, + 2 + ] }); } if (tst05("AAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 286, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 286, + 2 + ] }); } if (tst05("AAAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 287, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 287, + 2 + ] }); } if (tst05("AAAAAAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 288, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 288, + 2 + ] }); } if (tst05("AAAAAAAD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 289, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 289, + 2 + ] }); } if (tst05("BBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 290, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 290, + 2 + ] }); } if (tst05("BBBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 291, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 291, + 2 + ] }); } if (tst05("BBBBBBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 292, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 292, + 2 + ] }); } if (tst05("BBBBBBBD") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 293, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 293, + 2 + ] }); } @@ -1986,2407 +1789,2037 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 582, + 2 + ] }); } if (tst06(t00) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 583, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 583, + 2 + ] }); } if (tst06(s01) !== 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 584, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 584, + 2 + ] }); } if (tst06(t01) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 585, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 585, + 2 + ] }); } if (tst06(s02) !== 2) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 586, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 586, + 2 + ] }); } if (tst06(t02) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 587, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 587, + 2 + ] }); } if (tst06(s03) !== 3) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 588, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 588, + 2 + ] }); } if (tst06(t03) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 589, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 589, + 2 + ] }); } if (tst06(s04) !== 4) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 590, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 590, + 2 + ] }); } if (tst06(t04) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 591, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 591, + 2 + ] }); } if (tst06(s05) !== 5) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 592, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 592, + 2 + ] }); } if (tst06(t05) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 593, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 593, + 2 + ] }); } if (tst06(s06) !== 6) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 594, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 594, + 2 + ] }); } if (tst06(t06) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 595, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 595, + 2 + ] }); } if (tst06(s07) !== 7) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 596, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 596, + 2 + ] }); } if (tst06(t07) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 597, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 597, + 2 + ] }); } if (tst06(s08) !== 8) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 598, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 598, + 2 + ] }); } if (tst06(t08) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 599, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 599, + 2 + ] }); } if (tst06(s09) !== 9) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 600, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 600, + 2 + ] }); } if (tst06(t09) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 601, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 601, + 2 + ] }); } if (tst06(s10) !== 10) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 602, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 602, + 2 + ] }); } if (tst06(t10) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 603, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 603, + 2 + ] }); } if (tst06(s11) !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 604, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 604, + 2 + ] }); } if (tst06(t11) !== 11) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 605, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 605, + 2 + ] }); } if (tst06(s12) !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 606, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 606, + 2 + ] }); } if (tst06(t12) !== 12) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 607, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 607, + 2 + ] }); } if (tst06(s13) !== 13) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 608, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 608, + 2 + ] }); } if (tst06(t13) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 609, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 609, + 2 + ] }); } if (tst06(s14) !== 14) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 610, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 610, + 2 + ] }); } if (tst06(t14) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 611, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 611, + 2 + ] }); } if (tst06(s15) !== 15) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 612, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 612, + 2 + ] }); } if (tst06(t15) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 613, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 613, + 2 + ] }); } if (tst06(s16) !== 16) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 614, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 614, + 2 + ] }); } if (tst06(t16) !== 16) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 615, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 615, + 2 + ] }); } if (tst06(s17) !== 17) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 616, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 616, + 2 + ] }); } if (tst06(t17) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 617, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 617, + 2 + ] }); } if (tst06(s18) !== 18) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 618, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 618, + 2 + ] }); } if (tst06(t18) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 619, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 619, + 2 + ] }); } if (tst06(s19) !== 19) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 620, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 620, + 2 + ] }); } if (tst06(t19) !== 19) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 621, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 621, + 2 + ] }); } if (tst06(s20) !== 20) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 622, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 622, + 2 + ] }); } if (tst06(t20) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 623, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 623, + 2 + ] }); } if (tst06(s21) !== 21) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 624, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 624, + 2 + ] }); } if (tst06(t21) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 625, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 625, + 2 + ] }); } if (tst06(s22) !== 22) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 626, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 626, + 2 + ] }); } if (tst06(t22) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 627, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 627, + 2 + ] }); } if (tst06(s23) !== 23) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 628, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 628, + 2 + ] }); } if (tst06(t23) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 629, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 629, + 2 + ] }); } if (tst06(s24) !== 24) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 630, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 630, + 2 + ] }); } if (tst06(t24) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 631, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 631, + 2 + ] }); } if (tst06(s25) !== 25) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 632, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 632, + 2 + ] }); } if (tst06(t25) !== 25) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 633, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 633, + 2 + ] }); } if (tst06(s26) !== 26) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 634, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 634, + 2 + ] }); } if (tst06(t26) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 635, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 635, + 2 + ] }); } if (tst06(s27) !== 27) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 636, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 636, + 2 + ] }); } if (tst06(t27) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 637, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 637, + 2 + ] }); } if (tst06(s28) !== 28) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 638, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 638, + 2 + ] }); } if (tst06(t28) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 639, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 639, + 2 + ] }); } if (tst06(s29) !== 29) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 640, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 640, + 2 + ] }); } if (tst06(t29) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 641, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 641, + 2 + ] }); } if (tst06(s30) !== 30) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 642, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 642, + 2 + ] }); } if (tst06(t30) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 643, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 643, + 2 + ] }); } if (tst06(s31) !== 31) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 644, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 644, + 2 + ] }); } if (tst06(t31) !== 31) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 645, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 645, + 2 + ] }); } if (tst06(s32) !== 32) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 646, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 646, + 2 + ] }); } if (tst06(t32) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 647, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 647, + 2 + ] }); } if (tst06(s33) !== 33) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 648, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 648, + 2 + ] }); } if (tst06(t33) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 649, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 649, + 2 + ] }); } if (tst06(s34) !== 34) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 650, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 650, + 2 + ] }); } if (tst06(t34) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 651, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 651, + 2 + ] }); } if (tst06(s35) !== 35) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 652, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 652, + 2 + ] }); } if (tst06(t35) !== 35) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 653, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 653, + 2 + ] }); } if (tst06(s36) !== 36) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 654, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 654, + 2 + ] }); } if (tst06(t36) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 655, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 655, + 2 + ] }); } if (tst06(s37) !== 37) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 656, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 656, + 2 + ] }); } if (tst06(t37) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 657, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 657, + 2 + ] }); } if (tst06(s38) !== 38) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 658, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 658, + 2 + ] }); } if (tst06(t38) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 659, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 659, + 2 + ] }); } if (tst06(s39) !== 39) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 660, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 660, + 2 + ] }); } if (tst06(t39) !== 39) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 661, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 661, + 2 + ] }); } if (tst06(s40) !== 40) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 662, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 662, + 2 + ] }); } if (tst06(t40) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 663, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 663, + 2 + ] }); } if (tst06(s41) !== 41) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 664, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 664, + 2 + ] }); } if (tst06(t41) !== 41) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 665, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 665, + 2 + ] }); } if (tst06(s42) !== 42) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 666, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 666, + 2 + ] }); } if (tst06(t42) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 667, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 667, + 2 + ] }); } if (tst06(s43) !== 43) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 668, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 668, + 2 + ] }); } if (tst06(t43) !== 43) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 669, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 669, + 2 + ] }); } if (tst06(s44) !== 44) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 670, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 670, + 2 + ] }); } if (tst06(t44) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 671, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 671, + 2 + ] }); } if (tst06(s45) !== 45) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 672, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 672, + 2 + ] }); } if (tst06(t45) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 673, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 673, + 2 + ] }); } if (tst06(s46) !== 46) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 674, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 674, + 2 + ] }); } if (tst06(t46) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 675, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 675, + 2 + ] }); } if (tst06(s47) !== 47) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 676, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 676, + 2 + ] }); } if (tst06(t47) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 677, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 677, + 2 + ] }); } if (tst06(s48) !== 48) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 678, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 678, + 2 + ] }); } if (tst06(t48) !== 48) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 679, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 679, + 2 + ] }); } if (tst06(s49) !== 49) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 680, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 680, + 2 + ] }); } if (tst06(t49) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 681, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 681, + 2 + ] }); } if (tst06(s50) !== 50) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 682, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 682, + 2 + ] }); } if (tst06(t50) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 683, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 683, + 2 + ] }); } if (tst06(s51) !== 51) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 684, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 684, + 2 + ] }); } if (tst06(t51) !== 51) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 685, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 685, + 2 + ] }); } if (tst06(s52) !== 52) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 686, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 686, + 2 + ] }); } if (tst06(t52) !== 52) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 687, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 687, + 2 + ] }); } if (tst06(s53) !== 53) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 688, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 688, + 2 + ] }); } if (tst06(t53) !== 53) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 689, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 689, + 2 + ] }); } if (tst06(s54) !== 54) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 690, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 690, + 2 + ] }); } if (tst06(t54) !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 691, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 691, + 2 + ] }); } if (tst06(s55) !== 55) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 692, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 692, + 2 + ] }); } if (tst06(t55) !== 55) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 693, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 693, + 2 + ] }); } if (tst06(s56) !== 56) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 694, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 694, + 2 + ] }); } if (tst06(t56) !== 56) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 695, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 695, + 2 + ] }); } if (tst06(s57) !== 57) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 696, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 696, + 2 + ] }); } if (tst06(t57) !== 57) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 697, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 697, + 2 + ] }); } if (tst06(s58) !== 58) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 698, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 698, + 2 + ] }); } if (tst06(t58) !== 58) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 699, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 699, + 2 + ] }); } if (tst06(s59) !== 59) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 700, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 700, + 2 + ] }); } if (tst06(t59) !== 59) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 701, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 701, + 2 + ] }); } if (tst06(s60) !== 60) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 702, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 702, + 2 + ] }); } if (tst06(t60) !== 60) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 703, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 703, + 2 + ] }); } if (tst06(s61) !== 61) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 704, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 704, + 2 + ] }); } if (tst06(t61) !== 61) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 705, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 705, + 2 + ] }); } if (tst06(s62) !== 62) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 706, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 706, + 2 + ] }); } if (tst06(t62) !== 62) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 707, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 707, + 2 + ] }); } if (tst06(s63) !== 63) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 708, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 708, + 2 + ] }); } if (tst06(t63) !== 63) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 709, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 709, + 2 + ] }); } if (tst06(s64) !== 64) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 710, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 710, + 2 + ] }); } if (tst06(t64) !== 64) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 711, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 711, + 2 + ] }); } if (tst06(s65) !== 65) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 712, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 712, + 2 + ] }); } if (tst06(t65) !== 65) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 713, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 713, + 2 + ] }); } if (tst06(s66) !== 66) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 714, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 714, + 2 + ] }); } -if (tst06(t66) !== 66) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 715, - 2 - ] - } +if (tst06(t66) !== 66) { + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 715, + 2 + ] }); } if (tst06(s67) !== 67) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 716, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 716, + 2 + ] }); } if (tst06(t67) !== 67) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 717, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 717, + 2 + ] }); } if (tst06(s68) !== 68) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 718, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 718, + 2 + ] }); } if (tst06(t68) !== 68) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 719, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 719, + 2 + ] }); } if (tst06(s69) !== 69) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 720, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 720, + 2 + ] }); } if (tst06(t69) !== 69) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 721, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 721, + 2 + ] }); } if (tst06(s70) !== 70) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 722, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 722, + 2 + ] }); } if (tst06(t70) !== 70) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 723, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 723, + 2 + ] }); } if (tst06(s71) !== 71) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 724, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 724, + 2 + ] }); } if (tst06(t71) !== 71) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 725, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 725, + 2 + ] }); } if (tst06(s72) !== 72) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 726, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 726, + 2 + ] }); } if (tst06(t72) !== 72) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 727, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 727, + 2 + ] }); } if (tst06(s73) !== 73) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 728, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 728, + 2 + ] }); } if (tst06(t73) !== 73) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 729, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 729, + 2 + ] }); } if (tst06(s74) !== 74) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 730, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 730, + 2 + ] }); } if (tst06(t74) !== 74) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 731, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 731, + 2 + ] }); } if (tst06(s75) !== 75) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 732, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 732, + 2 + ] }); } if (tst06(t75) !== 75) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 733, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 733, + 2 + ] }); } if (tst06(s76) !== 76) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 734, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 734, + 2 + ] }); } if (tst06(t76) !== 76) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 735, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 735, + 2 + ] }); } if (tst06(s77) !== 77) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 736, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 736, + 2 + ] }); } if (tst06(t77) !== 77) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 737, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 737, + 2 + ] }); } if (tst06(s78) !== 78) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 738, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 738, + 2 + ] }); } if (tst06(t78) !== 78) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 739, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 739, + 2 + ] }); } if (tst06(s79) !== 79) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 740, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 740, + 2 + ] }); } if (tst06(t79) !== 79) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 741, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 741, + 2 + ] }); } if (tst06(s80) !== 80) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 742, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 742, + 2 + ] }); } if (tst06(t80) !== 80) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 743, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 743, + 2 + ] }); } if (tst06(s81) !== 81) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 744, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 744, + 2 + ] }); } if (tst06(t81) !== 81) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 745, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 745, + 2 + ] }); } if (tst06(s82) !== 82) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 746, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 746, + 2 + ] }); } if (tst06(t82) !== 82) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 747, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 747, + 2 + ] }); } if (tst06(s83) !== 83) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 748, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 748, + 2 + ] }); } if (tst06(t83) !== 83) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 749, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 749, + 2 + ] }); } if (tst06(s84) !== 84) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 750, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 750, + 2 + ] }); } if (tst06(t84) !== 84) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 751, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 751, + 2 + ] }); } if (tst06(s85) !== 85) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 752, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 752, + 2 + ] }); } if (tst06(t85) !== 85) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 753, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 753, + 2 + ] }); } if (tst06(s86) !== 86) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 754, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 754, + 2 + ] }); } if (tst06(t86) !== 86) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 755, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 755, + 2 + ] }); } if (tst06(s87) !== 87) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 756, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 756, + 2 + ] }); } if (tst06(t87) !== 87) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 757, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 757, + 2 + ] }); } if (tst06(s88) !== 88) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 758, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 758, + 2 + ] }); } if (tst06(t88) !== 88) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 759, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 759, + 2 + ] }); } if (tst06(s89) !== 89) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 760, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 760, + 2 + ] }); } if (tst06(t89) !== 89) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 761, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 761, + 2 + ] }); } if (tst06(s90) !== 90) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 762, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 762, + 2 + ] }); } if (tst06(t90) !== 90) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 763, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 763, + 2 + ] }); } if (tst06(s91) !== 91) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 764, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 764, + 2 + ] }); } if (tst06(t91) !== 91) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 765, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 765, + 2 + ] }); } if (tst06("") !== -1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stringmatch_test.res", - 766, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stringmatch_test.res", + 766, + 2 + ] }); } diff --git a/jscomp/test/test_array_primitive.js b/jscomp/test/test_array_primitive.js index 3ac46e92e8..bc107d9c1b 100644 --- a/jscomp/test/test_array_primitive.js +++ b/jscomp/test/test_array_primitive.js @@ -2,6 +2,7 @@ 'use strict'; let Caml_array = require("../../lib/js/caml_array.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function caml_array_sub(x, offset, len) { let result = new Array(len); @@ -13,11 +14,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } Caml_array.set(xs, index, newval); @@ -25,11 +24,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return Caml_array.get(xs, index); diff --git a/jscomp/test/test_bool_equal.js b/jscomp/test/test_bool_equal.js index d4a80430d8..2a0a1614e5 100644 --- a/jscomp/test/test_bool_equal.js +++ b/jscomp/test/test_bool_equal.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function bool_equal(x, y) { if (x) { @@ -18,51 +19,43 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 16, + 2 + ] }); } if (!bool_equal(false, false)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 17, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 17, + 2 + ] }); } if (bool_equal(true, false)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 18, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 18, + 2 + ] }); } if (bool_equal(false, true)) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_bool_equal.res", - 19, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_bool_equal.res", + 19, + 2 + ] }); } diff --git a/jscomp/test/test_closure.js b/jscomp/test/test_closure.js index 50cf48ad0a..879f12db3a 100644 --- a/jscomp/test/test_closure.js +++ b/jscomp/test/test_closure.js @@ -3,6 +3,7 @@ let $$Array = require("../../lib/js/array.js"); let Caml_array = require("../../lib/js/caml_array.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let v = { contents: 0 @@ -23,15 +24,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_closure.res", + 52, + 2 + ] }); } diff --git a/jscomp/test/test_exception.js b/jscomp/test/test_exception.js index d8fd225654..489c086306 100644 --- a/jscomp/test/test_exception.js +++ b/jscomp/test/test_exception.js @@ -3,57 +3,42 @@ let Test_common = require("./test_common.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Local, + _1: 3 }); } function g() { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function h() { - throw new Error(Test_common.U, { - cause: { - RE_EXN_ID: Test_common.U, - _1: 3 - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Test_common.U, + _1: 3 }); } function x() { - throw new Error(Test_common.H, { - cause: { - RE_EXN_ID: Test_common.H - } - }); + throw Caml_js_exceptions.internalMakeExn(Test_common.H); } function xx() { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "x" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "x" }); } let Nullary = /* @__PURE__ */Caml_exceptions.create("Test_exception.Nullary"); -let a = { - RE_EXN_ID: Nullary -}; +let a = Caml_js_exceptions.internalMakeExn(Nullary); exports.Local = Local; exports.f = f; diff --git a/jscomp/test/test_exception_escape.js b/jscomp/test/test_exception_escape.js index 418fec2b66..6b8b9c5984 100644 --- a/jscomp/test/test_exception_escape.js +++ b/jscomp/test/test_exception_escape.js @@ -2,17 +2,16 @@ 'use strict'; let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: A, + _1: 3 }); } catch (exn) { f = 3; diff --git a/jscomp/test/test_for_map.js b/jscomp/test/test_for_map.js index d5400a46d9..b4c82005d2 100644 --- a/jscomp/test/test_for_map.js +++ b/jscomp/test/test_for_map.js @@ -3,6 +3,7 @@ let Caml = require("../../lib/js/caml.js"); let Caml_option = require("../../lib/js/caml_option.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -43,11 +44,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -60,11 +59,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -78,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -95,11 +90,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -161,11 +154,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml.int_compare(x, param.v); if (c === 0) { @@ -180,11 +169,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -258,11 +243,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -366,11 +347,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -406,11 +383,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -444,11 +417,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -753,15 +724,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/jscomp/test/test_incomplete.js b/jscomp/test/test_incomplete.js index bfcf01440e..0312888674 100644 --- a/jscomp/test/test_incomplete.js +++ b/jscomp/test/test_incomplete.js @@ -1,20 +1,19 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Match_failure", + _1: [ + "test_incomplete.res", + 3, + 2 + ] }); } diff --git a/jscomp/test/test_int_map_find.js b/jscomp/test/test_int_map_find.js index 8accca8abe..445c3a8b74 100644 --- a/jscomp/test/test_int_map_find.js +++ b/jscomp/test/test_int_map_find.js @@ -3,6 +3,7 @@ let Caml = require("../../lib/js/caml.js"); let List = require("../../lib/js/list.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -32,11 +33,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -49,11 +48,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -67,11 +64,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -84,11 +79,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } diff --git a/jscomp/test/test_list.js b/jscomp/test/test_list.js index c40fc0b557..f1c752655f 100644 --- a/jscomp/test/test_list.js +++ b/jscomp/test/test_list.js @@ -4,6 +4,7 @@ let List = require("../../lib/js/list.js"); let Caml_obj = require("../../lib/js/caml_obj.js"); let Pervasives = require("../../lib/js/pervasives.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function length_aux(_len, _x) { while (true) { @@ -26,11 +27,9 @@ function hd(x) { if (x) { return x.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "hd" }); } @@ -38,21 +37,17 @@ function tl(x) { if (x) { return x.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "tl" }); } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -68,11 +63,9 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "nth" }); }; } @@ -207,21 +200,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } @@ -243,19 +232,15 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } return accu; @@ -273,21 +258,17 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); }; } @@ -304,19 +285,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } return accu; @@ -328,19 +305,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } return accu; @@ -387,21 +360,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); }; } @@ -419,21 +388,17 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); }; } @@ -477,11 +442,7 @@ function assoc(x, _x_) { _x_ = x_.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -496,11 +457,7 @@ function assq(x, _x_) { _x_ = x_.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -575,11 +532,7 @@ function find(p, _x) { _x = x.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -674,21 +627,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } @@ -726,15 +675,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_list.res", + 343, + 11 + ] }); }; } diff --git a/jscomp/test/test_literal.js b/jscomp/test/test_literal.js index d83f67d7df..8e2e5b678d 100644 --- a/jscomp/test/test_literal.js +++ b/jscomp/test/test_literal.js @@ -2,14 +2,15 @@ 'use strict'; let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let Custom_inline = /* @__PURE__ */Caml_exceptions.create("Test_literal.Custom_inline"); -let v = { +let v = Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Custom_inline, _1: 1, _2: 2 -}; +}); let vv = [ 1, diff --git a/jscomp/test/test_match_exception.js b/jscomp/test/test_match_exception.js index 6fe415efa7..a88c4b6f8b 100644 --- a/jscomp/test/test_match_exception.js +++ b/jscomp/test/test_match_exception.js @@ -7,13 +7,11 @@ function f(g, x) { try { return g(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..35422ade2c 100644 --- a/jscomp/test/test_per.js +++ b/jscomp/test/test_per.js @@ -5,22 +5,19 @@ let Caml_obj = require("../../lib/js/caml_obj.js"); let Caml_bytes = require("../../lib/js/caml_bytes.js"); let Caml_int64 = require("../../lib/js/caml_int64.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function failwith(s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: s - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: s }); } function invalid_arg(s) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } @@ -97,11 +94,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "char_of_int" }); } return n; diff --git a/jscomp/test/test_seq.js b/jscomp/test/test_seq.js index 10c3093667..5dcb7e1437 100644 --- a/jscomp/test/test_seq.js +++ b/jscomp/test/test_seq.js @@ -23,22 +23,16 @@ function assoc3(x, _l) { _l = l.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } function help_action() { - throw new Error(Stop, { - cause: { - RE_EXN_ID: Stop, - _1: { - TAG: "Unknown", - _0: "-help" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: "-help" } }); } @@ -58,7 +52,7 @@ function add_help(speclist) { assoc3("-help", speclist); add1 = /* [] */0; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { add1 = { hd: [ @@ -72,9 +66,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let add2; @@ -82,7 +74,7 @@ function add_help(speclist) { assoc3("--help", speclist); add2 = /* [] */0; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); if (exn$1.RE_EXN_ID === "Not_found") { add2 = { hd: [ @@ -96,9 +88,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..7573834b13 100644 --- a/jscomp/test/test_set.js +++ b/jscomp/test/test_set.js @@ -2,6 +2,7 @@ 'use strict'; let List = require("../../lib/js/list.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function Make(Ord) { let height = x => { @@ -31,11 +32,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l._2; @@ -47,11 +46,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -64,11 +61,9 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r._2; @@ -80,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, x_) => { @@ -151,11 +144,7 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = x._0; if (typeof l !== "object") { @@ -169,11 +158,7 @@ function Make(Ord) { while (true) { let x = _x; if (typeof x !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = x._2; if (typeof r !== "object") { @@ -185,11 +170,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = x._0; @@ -564,11 +547,7 @@ function Make(Ord) { while (true) { let x_ = _x_; if (typeof x_ !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = x_._1; let c = Ord.compare(x, v); @@ -670,15 +649,13 @@ function Make(Ord) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "test_set.res", - 497, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_set.res", + 497, + 20 + ] }); }; 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..8c0c98eea2 100644 --- a/jscomp/test/test_string.js +++ b/jscomp/test/test_string.js @@ -3,6 +3,7 @@ let Caml_bytes = require("../../lib/js/caml_bytes.js"); let Caml_string = require("../../lib/js/caml_string.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(x) { switch (x) { @@ -11,15 +12,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_string.res", + 5, + 17 + ] }); } } diff --git a/jscomp/test/test_string_case.js b/jscomp/test/test_string_case.js index 867814c4a6..cb6bc1e64b 100644 --- a/jscomp/test/test_string_case.js +++ b/jscomp/test/test_string_case.js @@ -1,6 +1,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function f(x) { switch (x) { @@ -9,15 +10,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_string_case.res", + 5, + 9 + ] }); } } diff --git a/jscomp/test/test_string_const.js b/jscomp/test/test_string_const.js index cadb0599f9..e46254ee8a 100644 --- a/jscomp/test/test_string_const.js +++ b/jscomp/test/test_string_const.js @@ -11,14 +11,12 @@ let hh; try { hh = Caml_string.get("ghsogh", -3); } catch (raw_e) { - let e = Caml_js_exceptions.internalToOCamlException(raw_e); + let e = Caml_js_exceptions.internalAnyToExn(raw_e); if (e.RE_EXN_ID === "Invalid_argument") { 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..b98f270ab0 100644 --- a/jscomp/test/test_string_map.js +++ b/jscomp/test/test_string_map.js @@ -2,6 +2,7 @@ 'use strict'; let Caml = require("../../lib/js/caml.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function height(param) { if (typeof param !== "object") { @@ -31,11 +32,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -48,11 +47,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -66,11 +63,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -83,11 +78,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -141,11 +134,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } 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..9ed5afebe4 100644 --- a/jscomp/test/test_trywith.js +++ b/jscomp/test/test_trywith.js @@ -16,121 +16,97 @@ function ff(g, x) { try { g(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID !== "Not_found") { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } try { g(x); } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$2) { - let exn$2 = Caml_js_exceptions.internalToOCamlException(raw_exn$2); + let exn$2 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$3) { - let exn$3 = Caml_js_exceptions.internalToOCamlException(raw_exn$3); + let exn$3 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$4) { - let exn$4 = Caml_js_exceptions.internalToOCamlException(raw_exn$4); + let exn$4 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$5) { - let exn$5 = Caml_js_exceptions.internalToOCamlException(raw_exn$5); + let exn$5 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$6) { - let exn$6 = Caml_js_exceptions.internalToOCamlException(raw_exn$6); + let exn$6 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$7) { - let exn$7 = Caml_js_exceptions.internalToOCamlException(raw_exn$7); + let exn$7 = Caml_js_exceptions.internalAnyToExn(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; } } try { g(x); } catch (raw_exn$8) { - let exn$8 = Caml_js_exceptions.internalToOCamlException(raw_exn$8); + let exn$8 = Caml_js_exceptions.internalAnyToExn(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; } } try { return g(x); } catch (raw_exn$9) { - let exn$9 = Caml_js_exceptions.internalToOCamlException(raw_exn$9); + let exn$9 = Caml_js_exceptions.internalAnyToExn(raw_exn$9); 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 Caml_js_exceptions.internalMakeExn("Not_found"); } function f(x) { @@ -140,15 +116,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_trywith.res", + 59, + 9 + ] }); } diff --git a/jscomp/test/test_while_closure.js b/jscomp/test/test_while_closure.js index 7235c903b0..3fdde881b4 100644 --- a/jscomp/test/test_while_closure.js +++ b/jscomp/test/test_while_closure.js @@ -3,6 +3,7 @@ let $$Array = require("../../lib/js/array.js"); let Caml_array = require("../../lib/js/caml_array.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); let v = { contents: 0 @@ -28,15 +29,13 @@ $$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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "test_while_closure.res", + 55, + 2 + ] }); } diff --git a/jscomp/test/ticker.js b/jscomp/test/ticker.js index 8f8c2e3a23..6ef2a1c175 100644 --- a/jscomp/test/ticker.js +++ b/jscomp/test/ticker.js @@ -25,16 +25,14 @@ function split(delim, s) { try { i$p = $$String.rindex_from(s, x - 1 | 0, delim); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return { hd: $$String.sub(s, 0, x), 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,11 +130,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -149,11 +145,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -167,11 +161,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -184,11 +176,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } @@ -250,11 +240,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml_obj.compare(x, param.v); if (c === 0) { @@ -269,11 +255,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -347,11 +329,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -455,11 +433,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -495,11 +469,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -533,11 +503,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -842,15 +810,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; @@ -1159,18 +1125,14 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "All nodes should be ranked" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "All nodes should be ranked" }); } else { let y = rhs.rank; @@ -1178,18 +1140,14 @@ function compute_update_sequences(all_tickers) { 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "All nodes should be ranked" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "All nodes should be ranked" }); } }, l); @@ -1206,11 +1164,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Only single Market ticker should be udpated upon a new quote" }); } let match$1 = match._0; @@ -1250,11 +1206,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } let ticker_map$1 = ticker_map !== undefined ? Caml_option.valFromOption(ticker_map) : compute_update_sequences(all_tickers); @@ -1265,18 +1219,14 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "Invalid input line" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); case "R" : let match$2 = tokens.tl; @@ -1291,11 +1241,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } return [ @@ -1306,18 +1254,14 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "Invalid input line" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); case "-" : let match$6 = match$3.tl; @@ -1325,11 +1269,9 @@ function process_input_line(ticker_map, all_tickers, line) { 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } return [ @@ -1340,26 +1282,20 @@ 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "Invalid input line" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); case "S" : if (match$3.tl) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } return [ @@ -1375,43 +1311,33 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } } else { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } } else { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } default: - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } } else { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "Invalid input line" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Invalid input line" }); } } diff --git a/jscomp/test/topsort_test.js b/jscomp/test/topsort_test.js index 286b48e805..74f0a9f5f8 100644 --- a/jscomp/test/topsort_test.js +++ b/jscomp/test/topsort_test.js @@ -121,15 +121,13 @@ if (!Caml_obj.equal(dfs1({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 35, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 35, + 2 + ] }); } @@ -160,15 +158,13 @@ if (!Caml_obj.equal(dfs1({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 38, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 38, + 2 + ] }); } @@ -222,15 +218,13 @@ if (!Caml_obj.equal(dfs2({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 57, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 57, + 2 + ] }); } @@ -259,15 +253,13 @@ if (!Caml_obj.equal(dfs2({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 58, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 58, + 2 + ] }); } @@ -314,15 +306,13 @@ if (!Caml_obj.equal(dfs3({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 74, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 74, + 2 + ] }); } @@ -351,15 +341,13 @@ if (!Caml_obj.equal(dfs3({ } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 75, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 75, + 2 + ] }); } @@ -439,15 +427,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 112, + 9 + ] }); } @@ -480,11 +466,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -496,11 +480,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -513,11 +495,9 @@ function bal(l, v, r) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -529,11 +509,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } @@ -618,11 +596,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -652,11 +626,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -684,11 +654,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -1103,11 +1071,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = Caml.string_compare(x, v); @@ -1123,11 +1087,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1189,11 +1149,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1400,15 +1356,13 @@ function of_list(l) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ] }); }; return sub(List.length(l$1), l$1)[0]; @@ -1472,13 +1426,11 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Cycle, + _1: { + hd: node, + tl: stack } }); } @@ -1525,15 +1477,13 @@ if (!Caml_obj.equal(pathsort(grwork), { } } })) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 144, - 9 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 144, + 9 + ] }); } @@ -1545,18 +1495,16 @@ try { ], tl: grwork }); - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 148, - 2 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 148, + 2 + ] }); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); let exit = 0; if (exn.RE_EXN_ID === Cycle) { let match = exn._1; @@ -1583,15 +1531,13 @@ try { exit = 1; } if (exit === 1) { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "topsort_test.res", - 151, - 7 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "topsort_test.res", + 151, + 7 + ] }); } diff --git a/jscomp/test/uncurried_cast.js b/jscomp/test/uncurried_cast.js index 5ed7b4c208..336057ffa2 100644 --- a/jscomp/test/uncurried_cast.js +++ b/jscomp/test/uncurried_cast.js @@ -3,11 +3,10 @@ let Belt_List = require("../../lib/js/belt_List.js"); let Caml_exceptions = require("../../lib/js/caml_exceptions.js"); +let Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js"); function raise(e) { - throw new Error(e.RE_EXN_ID, { - cause: e - }); + throw e; } let map = Belt_List.map; @@ -24,11 +23,7 @@ let Uncurried = { let E = /* @__PURE__ */Caml_exceptions.create("Uncurried_cast.E"); function testRaise() { - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw Caml_js_exceptions.internalMakeExn(E); } let l = Belt_List.map({ @@ -66,11 +61,7 @@ let StandardNotation = { }; function testRaise$1() { - throw new Error(E, { - cause: { - RE_EXN_ID: E - } - }); + throw Caml_js_exceptions.internalMakeExn(E); } let l$1 = Belt_List.map({ diff --git a/jscomp/test/variant.js b/jscomp/test/variant.js index d184ff6061..b1c5656695 100644 --- a/jscomp/test/variant.js +++ b/jscomp/test/variant.js @@ -81,7 +81,7 @@ function rollback_path(subst, p) { try { return "try"; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { switch (p.TAG) { case "Pdot" : @@ -91,9 +91,7 @@ function rollback_path(subst, p) { return "Pident | Papply"; } } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } } @@ -112,7 +110,7 @@ function fooExn(f) { try { return f(); } catch (raw_n) { - let n = Caml_js_exceptions.internalToOCamlException(raw_n); + let n = Caml_js_exceptions.internalAnyToExn(raw_n); if (n.RE_EXN_ID === EA1) { return 1; } @@ -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..7571fbc340 100644 --- a/lib/es6/arg.js +++ b/lib/es6/arg.js @@ -31,11 +31,7 @@ function assoc3(x, _l) { _l = l.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -57,13 +53,11 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: "-help" } }); } @@ -74,7 +68,7 @@ function add_help(speclist) { assoc3("-help", speclist); add1 = /* [] */0; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { add1 = { hd: [ @@ -88,9 +82,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let add2; @@ -98,7 +90,7 @@ function add_help(speclist) { assoc3("--help", speclist); add2 = /* [] */0; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); if (exn$1.RE_EXN_ID === "Not_found") { add2 = { hd: [ @@ -112,9 +104,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)); @@ -155,13 +145,11 @@ function bool_of_string_opt(x) { try { return Pervasives.bool_of_string(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Invalid_argument") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -169,13 +157,11 @@ function int_of_string_opt(x) { try { return Caml_format.int_of_string(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -183,13 +169,11 @@ function float_of_string_opt(x) { try { return Caml_format.float_of_string(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -227,15 +211,15 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist TAG: "Unknown", _0: "--help" })) { - return { + return Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Help, _1: Buffer.contents(b) - }; + }); } else { - return { + return Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Bad, _1: Buffer.contents(b) - }; + }); } }; current.contents = current.contents + 1 | 0; @@ -250,7 +234,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist undefined ]; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { try { let match$1 = split(s); @@ -259,26 +243,20 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist match$1[1] ]; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: s } }); } - 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,15 +264,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: follow, + _2: "no argument" } }); }; @@ -305,13 +281,11 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Missing", + _0: s } }); }; @@ -333,15 +307,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg, + _2: "a boolean" } }); } @@ -367,15 +339,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$2, + _2: "an integer" } }); } @@ -386,15 +356,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$3, + _2: "an integer" } }); } @@ -405,15 +373,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$4, + _2: "a float" } }); } @@ -424,15 +390,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$5, + _2: "a float" } }); } @@ -446,15 +410,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$6, + _2: "one of: " + make_symlist("", " ", "", symb) } }); case "Rest" : @@ -466,11 +428,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Arg.Expand is is only allowed with Arg.parse_and_expand_argv_dynamic" }); } let arg$7 = get_arg(); @@ -496,26 +456,17 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist anonfun(s); } } catch (raw_m) { - let m = Caml_js_exceptions.internalToOCamlException(raw_m); + let m = Caml_js_exceptions.internalAnyToExn(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; }; @@ -543,7 +494,7 @@ function parse(l, f, msg) { try { return parse_argv(undefined, Sys.argv, l, f, msg); } catch (raw_msg) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg$1 = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); return Pervasives.exit(2); @@ -552,9 +503,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; } } @@ -562,7 +511,7 @@ function parse_dynamic(l, f, msg) { try { return parse_argv_dynamic(undefined, Sys.argv, l, f, msg); } catch (raw_msg) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg$1 = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); return Pervasives.exit(2); @@ -571,9 +520,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; } } @@ -590,7 +537,7 @@ function parse_expand(l, f, msg) { }; return parse_and_expand_argv_dynamic(current$1, argv, spec, f, msg); } catch (raw_msg) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg$1 = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); return Pervasives.exit(2); @@ -599,9 +546,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; } } @@ -624,7 +569,7 @@ function second_word(s) { try { n = $$String.index(s, /* '\t' */9); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let exit = 0; let n$1; @@ -632,22 +577,18 @@ function second_word(s) { n$1 = $$String.index(s, /* ' ' */32); exit = 2; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); 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..690b9f275a 100644 --- a/lib/es6/array.js +++ b/lib/es6/array.js @@ -14,11 +14,9 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.init" }); } let res = Caml_array.make(l, f(0)); @@ -58,11 +56,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" }); } return Caml_array.sub(a, ofs, len); @@ -70,11 +66,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill" }); } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { @@ -84,11 +78,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" }); } Caml_array.blit(a1, ofs1, a2, ofs2, len); @@ -102,11 +94,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length" }); } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { @@ -130,11 +120,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length" }); } if (la === 0) { @@ -317,11 +305,9 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Bottom, + _1: i }); }; let trickle = (l, i, e) => { @@ -338,13 +324,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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) => { @@ -358,13 +342,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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,15 +354,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "array.res", + 321, + 4 + ] }); } if (cmp(Caml_array.get(a, father), e) >= 0) { diff --git a/lib/es6/arrayLabels.js b/lib/es6/arrayLabels.js index 4952c602c5..1584532407 100644 --- a/lib/es6/arrayLabels.js +++ b/lib/es6/arrayLabels.js @@ -14,11 +14,9 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.init" }); } let res = Caml_array.make(l, f(0)); @@ -58,11 +56,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" }); } return Caml_array.sub(a, ofs, len); @@ -70,11 +66,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill" }); } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { @@ -84,11 +78,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" }); } Caml_array.blit(a1, ofs1, a2, ofs2, len); @@ -102,11 +94,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length" }); } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { @@ -130,11 +120,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length" }); } if (la === 0) { @@ -317,11 +305,9 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Bottom, + _1: i }); }; let trickle = (l, i, e) => { @@ -338,13 +324,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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) => { @@ -358,13 +342,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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,15 +354,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "arrayLabels.res", + 321, + 4 + ] }); } if (cmp(Caml_array.get(a, father), e) >= 0) { diff --git a/lib/es6/belt_Array.js b/lib/es6/belt_Array.js index c3d940cbf5..91cbe786be 100644 --- a/lib/es6/belt_Array.js +++ b/lib/es6/belt_Array.js @@ -2,6 +2,7 @@ import * as Caml from "./caml.js"; import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function get(arr, i) { if (i >= 0 && i < arr.length) { @@ -12,15 +13,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 36, + 2 + ] }); } return arr[i]; @@ -37,15 +36,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 49, + 2 + ] }); } arr[i] = v; diff --git a/lib/es6/belt_List.js b/lib/es6/belt_List.js index a4c8e13787..0c67200028 100644 --- a/lib/es6/belt_List.js +++ b/lib/es6/belt_List.js @@ -3,6 +3,7 @@ import * as Belt_Array from "./belt_Array.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function head(x) { if (x) { @@ -15,11 +16,7 @@ function headExn(x) { if (x) { return x.hd; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function tail(x) { @@ -33,11 +30,7 @@ function tailExn(x) { if (x) { return x.tl; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function add(xs, x) { @@ -71,11 +64,7 @@ function get(x, n) { function getExn(x, n) { if (n < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let _x = x; let _n = n; @@ -90,11 +79,7 @@ function getExn(x, n) { _x = x$1.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/belt_MutableQueue.js b/lib/es6/belt_MutableQueue.js index 40a4a0cc97..dda4f1f3cd 100644 --- a/lib/es6/belt_MutableQueue.js +++ b/lib/es6/belt_MutableQueue.js @@ -1,6 +1,7 @@ import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function make() { return { @@ -54,11 +55,7 @@ function peekExn(q) { if (v !== undefined) { return v.content; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function pop(q) { @@ -90,11 +87,7 @@ function popExn(q) { return x.content; } } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function popUndefined(q) { diff --git a/lib/es6/belt_Option.js b/lib/es6/belt_Option.js index 12cb715f94..84fc68fc7b 100644 --- a/lib/es6/belt_Option.js +++ b/lib/es6/belt_Option.js @@ -1,6 +1,7 @@ import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function keep(opt, p) { if (opt !== undefined && p(Caml_option.valFromOption(opt))) { @@ -20,11 +21,7 @@ function getExn(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function mapWithDefault(opt, $$default, f) { diff --git a/lib/es6/belt_Result.js b/lib/es6/belt_Result.js index 90f1370d0e..0b4d04ef62 100644 --- a/lib/es6/belt_Result.js +++ b/lib/es6/belt_Result.js @@ -1,15 +1,12 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function getExn(x) { if (x.TAG === "Ok") { return x._0; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function mapWithDefault(opt, $$default, f) { diff --git a/lib/es6/belt_internalAVLset.js b/lib/es6/belt_internalAVLset.js index 3e680658a9..25a9985955 100644 --- a/lib/es6/belt_internalAVLset.js +++ b/lib/es6/belt_internalAVLset.js @@ -2,6 +2,7 @@ import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function copy(n) { if (n !== undefined) { @@ -349,15 +350,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLset.res", + 310, + 4 + ] }); } checkInvariantInternal(l); @@ -700,11 +699,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/belt_internalAVLtree.js b/lib/es6/belt_internalAVLtree.js index dcbd04e32e..a1a80090ca 100644 --- a/lib/es6/belt_internalAVLtree.js +++ b/lib/es6/belt_internalAVLtree.js @@ -2,6 +2,7 @@ import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function treeHeight(n) { if (n !== undefined) { @@ -546,15 +547,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLtree.res", + 439, + 4 + ] }); } checkInvariantInternal(l); @@ -849,11 +848,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/belt_internalMapInt.js b/lib/es6/belt_internalMapInt.js index 7f54f84751..da9f6d5dfb 100644 --- a/lib/es6/belt_internalMapInt.js +++ b/lib/es6/belt_internalMapInt.js @@ -3,6 +3,7 @@ import * as Caml from "./caml.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; function add(t, x, data) { @@ -62,11 +63,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/belt_internalMapString.js b/lib/es6/belt_internalMapString.js index d048bcc96f..d3725cf525 100644 --- a/lib/es6/belt_internalMapString.js +++ b/lib/es6/belt_internalMapString.js @@ -3,6 +3,7 @@ import * as Caml from "./caml.js"; import * as Caml_option from "./caml_option.js"; import * as Belt_SortArray from "./belt_SortArray.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; import * as Belt_internalAVLtree from "./belt_internalAVLtree.js"; function add(t, x, data) { @@ -62,11 +63,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/belt_internalSetInt.js b/lib/es6/belt_internalSetInt.js index 25243c2d97..bd1f5a8bbf 100644 --- a/lib/es6/belt_internalSetInt.js +++ b/lib/es6/belt_internalSetInt.js @@ -1,6 +1,7 @@ import * as Belt_SortArrayInt from "./belt_SortArrayInt.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; import * as Belt_internalAVLset from "./belt_internalAVLset.js"; function has(_t, x) { @@ -141,11 +142,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/belt_internalSetString.js b/lib/es6/belt_internalSetString.js index cf752d348b..a1b44b7e1f 100644 --- a/lib/es6/belt_internalSetString.js +++ b/lib/es6/belt_internalSetString.js @@ -1,5 +1,6 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; import * as Belt_internalAVLset from "./belt_internalAVLset.js"; import * as Belt_SortArrayString from "./belt_SortArrayString.js"; @@ -141,11 +142,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/es6/buffer.js b/lib/es6/buffer.js index 13da86c768..63b0d64f21 100644 --- a/lib/es6/buffer.js +++ b/lib/es6/buffer.js @@ -4,6 +4,7 @@ import * as Bytes from "./bytes.js"; import * as $$String from "./string.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_string from "./caml_string.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function create(n) { let n$1 = n < 1 ? 1 : n; @@ -26,11 +27,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub" }); } return Bytes.sub_string(b.buffer, ofs, len); @@ -38,11 +37,9 @@ function sub(b, 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit" }); } Bytes.blit(src.buffer, srcoff, dst, dstoff, len); @@ -50,11 +47,9 @@ function blit(src, 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth" }); } return b.buffer[ofs]; @@ -98,15 +93,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 98, + 18 + ] }); } if (u$1 <= 127) { @@ -145,30 +138,26 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 127, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 132, + 18 + ] }); } if (u$1 <= 65535) { @@ -196,30 +185,26 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 154, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 159, + 18 + ] }); } if (u$1 <= 65535) { @@ -247,25 +232,21 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 181, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.add_substring/add_subbytes" }); } let new_position = b.position + len | 0; @@ -305,15 +286,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 216, + 9 + ] }); } @@ -325,11 +304,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (Caml_string.get(s, i) === opening) { _i = i + 1 | 0; @@ -383,11 +358,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml_string.get(s, start); if (c !== 40 && c !== 123) { @@ -455,11 +426,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate" }); } b.position = len; diff --git a/lib/es6/bytes.js b/lib/es6/bytes.js index ef34d50b27..652f1a5a25 100644 --- a/lib/es6/bytes.js +++ b/lib/es6/bytes.js @@ -110,11 +110,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub" }); } let r = Caml_bytes.create(len); @@ -138,22 +136,18 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } return c; @@ -180,11 +174,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" }); } unsafe_fill(s, ofs, len, c); @@ -192,11 +184,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" }); } unsafe_blit(s1, ofs1, s2, ofs2, len); @@ -204,11 +194,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" }); } if (len <= 0) { @@ -245,11 +233,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat" }); } @@ -489,11 +475,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -528,11 +510,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -541,11 +521,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -555,11 +533,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -575,11 +549,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -605,11 +577,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -618,24 +588,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,24 +611,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..652f1a5a25 100644 --- a/lib/es6/bytesLabels.js +++ b/lib/es6/bytesLabels.js @@ -110,11 +110,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub" }); } let r = Caml_bytes.create(len); @@ -138,22 +136,18 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } return c; @@ -180,11 +174,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" }); } unsafe_fill(s, ofs, len, c); @@ -192,11 +184,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" }); } unsafe_blit(s1, ofs1, s2, ofs2, len); @@ -204,11 +194,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" }); } if (len <= 0) { @@ -245,11 +233,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat" }); } @@ -489,11 +475,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -528,11 +510,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -541,11 +521,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -555,11 +533,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -575,11 +549,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -605,11 +577,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -618,24 +588,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,24 +611,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..d357cd77fa 100644 --- a/lib/es6/caml_array.js +++ b/lib/es6/caml_array.js @@ -1,5 +1,6 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function sub(x, offset, len) { let result = new Array(len); @@ -57,11 +58,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } xs[index] = newval; @@ -69,11 +68,9 @@ function set(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return xs[index]; diff --git a/lib/es6/caml_bigint.js b/lib/es6/caml_bigint.js index bdac616c54..1c64537c54 100644 --- a/lib/es6/caml_bigint.js +++ b/lib/es6/caml_bigint.js @@ -1,24 +1,17 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function div(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw Caml_js_exceptions.internalMakeExn("Division_by_zero"); } return x / y; } function mod_(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw Caml_js_exceptions.internalMakeExn("Division_by_zero"); } return x % y; } diff --git a/lib/es6/caml_bytes.js b/lib/es6/caml_bytes.js index 72ae5a5032..8563150cde 100644 --- a/lib/es6/caml_bytes.js +++ b/lib/es6/caml_bytes.js @@ -1,13 +1,12 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } s[i] = ch; @@ -15,11 +14,9 @@ function set(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return s[i]; @@ -27,11 +24,9 @@ function get(s, i) { function create(len) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.create" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.create" }); } let result = new Array(len); diff --git a/lib/es6/caml_exceptions.js b/lib/es6/caml_exceptions.js index 9db019af3c..65e91666e1 100644 --- a/lib/es6/caml_exceptions.js +++ b/lib/es6/caml_exceptions.js @@ -14,11 +14,11 @@ function create(str) { return str; } -function is_extension(e) { - if (e == null) { - return false; +function is_extension(any) { + if (any) { + return typeof any.RE_EXN_ID === "string"; } else { - return typeof e.RE_EXN_ID === "string"; + return false; } } diff --git a/lib/es6/caml_format.js b/lib/es6/caml_format.js index e0441baf86..d0a2a02a8e 100644 --- a/lib/es6/caml_format.js +++ b/lib/es6/caml_format.js @@ -2,6 +2,7 @@ import * as Caml from "./caml.js"; import * as Caml_int64 from "./caml_int64.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function parse_digit(c) { if (c >= 65) { @@ -129,11 +130,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } let aux = (_acc, _k) => { @@ -150,20 +149,16 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } let acc$1 = base * acc + v; if (acc$1 > threshold) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } _k = k + 1 | 0; @@ -174,11 +169,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } return or_res; @@ -218,11 +211,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int64_of_string" }); } let aux = (_acc, _k) => { @@ -239,11 +230,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int64_of_string" }); } let acc$1 = Caml_int64.add(Caml_int64.mul(base, acc), v); @@ -258,11 +247,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int64_of_string" }); } return or_res; @@ -290,11 +277,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "format_int: format too long" }); } let f = { @@ -777,10 +762,10 @@ let float_of_string = (function(s,exn){ }); function float_of_string$1(s) { - return float_of_string(s, { + return float_of_string(s, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "float_of_string" - }); + })); } export { diff --git a/lib/es6/caml_int32.js b/lib/es6/caml_int32.js index b5cd97b472..7f05e07fc8 100644 --- a/lib/es6/caml_int32.js +++ b/lib/es6/caml_int32.js @@ -1,24 +1,17 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function div(x, y) { if (y === 0) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw Caml_js_exceptions.internalMakeExn("Division_by_zero"); } 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 Caml_js_exceptions.internalMakeExn("Division_by_zero"); } return x % y; } diff --git a/lib/es6/caml_int64.js b/lib/es6/caml_int64.js index 7e0be85c45..74149d642c 100644 --- a/lib/es6/caml_int64.js +++ b/lib/es6/caml_int64.js @@ -1,6 +1,7 @@ import * as Caml from "./caml.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function mk(lo, hi) { return [ @@ -383,11 +384,7 @@ 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 Caml_js_exceptions.internalMakeExn("Division_by_zero"); } 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..903d903419 100644 --- a/lib/es6/caml_js_exceptions.js +++ b/lib/es6/caml_js_exceptions.js @@ -1,20 +1,33 @@ import * as Caml_option from "./caml_option.js"; -import * as Caml_exceptions from "./caml_exceptions.js"; let $$Error = "JsError"; -function internalToOCamlException(e) { - if (Caml_exceptions.is_extension(e.cause)) { - return e.cause; - } else { - return { - RE_EXN_ID: "JsError", - _1: e - }; +class RescriptError extends Error { + constructor(message) { + super(message); + this.RE_EXN_ID = message; } } +; + +function internalMakeExn(prim) { + return new RescriptError(prim); +} + +function internalFromExtension(_ext) { + return (Object.assign(new RescriptError(_ext.RE_EXN_ID), _ext)); +} + +function internalAnyToExn(any) { + if (any && typeof any.RE_EXN_ID === "string") { + return any; + } + let exn = new RescriptError("JsError"); + exn._1 = any; + return exn; +} function as_js_exn(exn) { if (exn.RE_EXN_ID === $$Error) { @@ -25,7 +38,9 @@ function as_js_exn(exn) { export { $$Error, - internalToOCamlException, + internalMakeExn, + internalFromExtension, + internalAnyToExn, as_js_exn, } -/* No side effect */ +/* Not a pure module */ diff --git a/lib/es6/caml_lexer.js b/lib/es6/caml_lexer.js index b50a5a45f6..89e23e0373 100644 --- a/lib/es6/caml_lexer.js +++ b/lib/es6/caml_lexer.js @@ -1,5 +1,6 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; /***********************************************************************/ /* */ @@ -104,10 +105,10 @@ let caml_lex_engine_aux = (function (tbl, start_state, lexbuf, exn){ let empty_token_lit = "lexing: empty token"; function lex_engine(tbls, i, buf) { - return caml_lex_engine_aux(tbls, i, buf, { + return caml_lex_engine_aux(tbls, i, buf, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: empty_token_lit - }); + })); } /***********************************************/ @@ -245,10 +246,10 @@ let caml_new_lex_engine_aux = (function (tbl, start_state, lexbuf, exn) { }); function new_lex_engine(tbl, i, buf) { - return caml_new_lex_engine_aux(tbl, i, buf, { + return caml_new_lex_engine_aux(tbl, i, buf, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: empty_token_lit - }); + })); } export { diff --git a/lib/es6/caml_module.js b/lib/es6/caml_module.js index 51988ea254..459b196ccc 100644 --- a/lib/es6/caml_module.js +++ b/lib/es6/caml_module.js @@ -1,14 +1,13 @@ import * as Caml_obj from "./caml_obj.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Undefined_recursive_module", + _1: loc }); }; let loop = (shape, struct_, idx) => { @@ -74,15 +73,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ] }); } if (shape.TAG === "Module") { @@ -94,15 +91,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ] }); } diff --git a/lib/es6/caml_obj.js b/lib/es6/caml_obj.js index 9d025bf517..dffc32b965 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -1,6 +1,7 @@ import * as Caml from "./caml.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; let for_in = (function(o,foo){ for (var x in o) { foo(x) }}); @@ -55,11 +56,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "compare: functional value" }); } break; @@ -136,11 +135,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value" }); } if (tag_a !== tag_b) { @@ -262,11 +259,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "equal: functional value" }); } if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { @@ -278,11 +273,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value" }); } if (tag_a !== tag_b) { diff --git a/lib/es6/caml_string.js b/lib/es6/caml_string.js index 8fe93ba893..fc94b26cd4 100644 --- a/lib/es6/caml_string.js +++ b/lib/es6/caml_string.js @@ -1,13 +1,12 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return s.codePointAt(i); diff --git a/lib/es6/caml_sys.js b/lib/es6/caml_sys.js index c1b42a6668..91f10467c3 100644 --- a/lib/es6/caml_sys.js +++ b/lib/es6/caml_sys.js @@ -1,23 +1,16 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function sys_getenv(s) { if (typeof process === "undefined" || process.env === undefined) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let x = process.env[s]; if (x !== undefined) { return x; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let os_type = (function(_){ @@ -73,20 +66,16 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "sys_is_directory not implemented" }); } function sys_file_exists(_s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_file_exists not implemented" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "sys_file_exists not implemented" }); } diff --git a/lib/es6/camlinternalLazy.js b/lib/es6/camlinternalLazy.js index 59fa0b914d..537178d412 100644 --- a/lib/es6/camlinternalLazy.js +++ b/lib/es6/camlinternalLazy.js @@ -1,6 +1,7 @@ import * as Caml_exceptions from "./caml_exceptions.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function is_val(l) { return l.LAZY_DONE; @@ -16,11 +17,7 @@ function forward_with_closure(blk, closure) { } function raise_undefined() { - throw new Error(Undefined, { - cause: { - RE_EXN_ID: Undefined - } - }); + throw Caml_js_exceptions.internalMakeExn(Undefined); } function force(lzv) { @@ -33,13 +30,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..74519090da 100644 --- a/lib/es6/char.js +++ b/lib/es6/char.js @@ -1,14 +1,13 @@ import * as Bytes from "./bytes.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function chr(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr" }); } return n; diff --git a/lib/es6/digest.js b/lib/es6/digest.js index 1eded13e8a..d8abc7eb21 100644 --- a/lib/es6/digest.js +++ b/lib/es6/digest.js @@ -6,6 +6,7 @@ import * as $$String from "./string.js"; import * as Caml_md5 from "./caml_md5.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_string from "./caml_string.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function string(str) { return Caml_md5.md5_string(str, 0, str.length); @@ -17,11 +18,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring" }); } return Caml_md5.md5_string(str, ofs, len); @@ -39,11 +38,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.to_hex" }); } let result = Caml_bytes.create(32); @@ -57,42 +54,34 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } return c - /* '0' */48 | 0; diff --git a/lib/es6/filename.js b/lib/es6/filename.js index 38a8258878..4ae5cf8ae1 100644 --- a/lib/es6/filename.js +++ b/lib/es6/filename.js @@ -119,13 +119,11 @@ let temp_dir_name; try { temp_dir_name = Caml_sys.sys_getenv("TMPDIR"); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { temp_dir_name = "/tmp"; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -201,13 +199,11 @@ let temp_dir_name$1; try { temp_dir_name$1 = Caml_sys.sys_getenv("TEMP"); } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); 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,11 +378,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix" }); } return $$String.sub(name, 0, n); @@ -430,11 +424,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension" }); } return $$String.sub(name, 0, name.length - l | 0); diff --git a/lib/es6/genlex.js b/lib/es6/genlex.js index d3d551a979..14e6b2365a 100644 --- a/lib/es6/genlex.js +++ b/lib/es6/genlex.js @@ -51,16 +51,14 @@ function make_lexer(keywords) { try { return Hashtbl.find(kwd_table, id); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return { TAG: "Ident", _0: id }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let keyword_or_error = c => { @@ -68,18 +66,14 @@ function make_lexer(keywords) { try { return Hashtbl.find(kwd_table, s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "Illegal character " + s }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let next_token = strm__ => { @@ -116,27 +110,21 @@ function make_lexer(keywords) { try { c$1 = char(strm__); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } - 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } Stream.junk(strm__); @@ -145,11 +133,9 @@ function make_lexer(keywords) { _0: c$1 }; } - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); case 40 : Stream.junk(strm__); @@ -471,18 +457,14 @@ function make_lexer(keywords) { try { c$1 = escape(strm__); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } store(c$1); continue; @@ -490,11 +472,7 @@ function make_lexer(keywords) { Stream.junk(strm__); return get_string(); } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); }; }; let char = strm__ => { @@ -508,25 +486,17 @@ function make_lexer(keywords) { try { return escape(strm__); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); } }; let escape = strm__ => { @@ -553,50 +523,38 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Stream.$$Error, _1: "" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } Stream.junk(strm__); return c1; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); } }; let comment = strm__ => { @@ -617,11 +575,7 @@ function make_lexer(keywords) { return comment(strm__); } } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); case 42 : Stream.junk(strm__); while (true) { @@ -638,22 +592,14 @@ function make_lexer(keywords) { Stream.junk(strm__); return; } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); }; default: Stream.junk(strm__); continue; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); } }; }; diff --git a/lib/es6/hashtbl.js b/lib/es6/hashtbl.js index 4337892b11..dc616ddf59 100644 --- a/lib/es6/hashtbl.js +++ b/lib/es6/hashtbl.js @@ -9,6 +9,7 @@ import * as Caml_array from "./caml_array.js"; import * as Pervasives from "./pervasives.js"; import * as Caml_option from "./caml_option.js"; import * as CamlinternalLazy from "./camlinternalLazy.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function hash(x) { return Caml_hash.hash(10, 100, 0, x); @@ -109,15 +110,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "hashtbl.res", + 110, + 19 + ] }); } prec.next = r; @@ -252,11 +251,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k1 = match.key; let d1 = match.data; @@ -265,11 +260,7 @@ function find(h, key) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k2 = next1.key; let d2 = next1.data; @@ -278,11 +269,7 @@ function find(h, key) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k3 = next2.key; let d3 = next2.data; @@ -294,11 +281,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k = param.key; let data = param.data; @@ -468,14 +451,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 +504,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 +543,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 +625,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k1 = match.key; let d1 = match.data; @@ -667,11 +634,7 @@ function MakeSeeded(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k2 = next1.key; let d2 = next1.data; @@ -680,11 +643,7 @@ function MakeSeeded(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k3 = next2.key; let d3 = next2.data; @@ -696,11 +655,7 @@ function MakeSeeded(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k = param.key; let data = param.data; @@ -900,11 +855,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k1 = match.key; let d1 = match.data; @@ -913,11 +864,7 @@ function Make(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k2 = next1.key; let d2 = next1.data; @@ -926,11 +873,7 @@ function Make(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k3 = next2.key; let d3 = next2.data; @@ -942,11 +885,7 @@ function Make(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k = param.key; let data = param.data; diff --git a/lib/es6/int32.js b/lib/es6/int32.js index 044b7687ef..948558a311 100644 --- a/lib/es6/int32.js +++ b/lib/es6/int32.js @@ -32,13 +32,11 @@ function of_string_opt(s) { try { return Caml_format.int_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..bc2c55337c 100644 --- a/lib/es6/int64.js +++ b/lib/es6/int64.js @@ -25,13 +25,11 @@ function of_string_opt(s) { try { return Caml_format.int64_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..9bbc4518a9 100644 --- a/lib/es6/lexing.js +++ b/lib/es6/lexing.js @@ -4,6 +4,7 @@ import * as Bytes from "./bytes.js"; import * as Caml_array from "./caml_array.js"; import * as Caml_bytes from "./caml_bytes.js"; import * as Caml_lexer from "./caml_lexer.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function engine(tbl, state, buf) { let result = Caml_lexer.lex_engine(tbl, state, buf); @@ -54,11 +55,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Lexing.lex_refill: cannot grow buffer" }); } let newbuf = Caml_bytes.create(newlen); diff --git a/lib/es6/list.js b/lib/es6/list.js index 09ebf99bde..de944f0965 100644 --- a/lib/es6/list.js +++ b/lib/es6/list.js @@ -3,6 +3,7 @@ import * as Caml_obj from "./caml_obj.js"; import * as Pervasives from "./pervasives.js"; import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function length(l) { let _len = 0; @@ -30,11 +31,9 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "hd" }); } @@ -42,21 +41,17 @@ function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "tl" }); } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -72,22 +67,18 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "nth" }); }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -156,11 +147,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.init" }); } if (len > 10000) { @@ -280,21 +269,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } @@ -316,19 +301,15 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } return accu; @@ -346,21 +327,17 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); }; } @@ -377,19 +354,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } return accu; @@ -401,19 +374,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } return accu; @@ -460,21 +429,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); }; } @@ -492,21 +457,17 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); }; } @@ -550,11 +511,7 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -584,11 +541,7 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -678,11 +631,7 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -790,21 +739,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } @@ -842,15 +787,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "list.res", + 420, + 11 + ] }); }; } diff --git a/lib/es6/listLabels.js b/lib/es6/listLabels.js index b614cbfc27..da8eb3bf03 100644 --- a/lib/es6/listLabels.js +++ b/lib/es6/listLabels.js @@ -3,6 +3,7 @@ import * as Caml_obj from "./caml_obj.js"; import * as Pervasives from "./pervasives.js"; import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function length(l) { let _len = 0; @@ -30,11 +31,9 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "hd" }); } @@ -42,21 +41,17 @@ function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "tl" }); } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -72,22 +67,18 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "nth" }); }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -156,11 +147,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.init" }); } if (len > 10000) { @@ -280,21 +269,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } @@ -316,19 +301,15 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } return accu; @@ -346,21 +327,17 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); }; } @@ -377,19 +354,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } return accu; @@ -401,19 +374,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } return accu; @@ -460,21 +429,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); }; } @@ -492,21 +457,17 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); }; } @@ -550,11 +511,7 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -584,11 +541,7 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -678,11 +631,7 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -790,21 +739,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } @@ -842,15 +787,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "listLabels.res", + 420, + 11 + ] }); }; } diff --git a/lib/es6/map.js b/lib/es6/map.js index 2052415d99..fdb9e8e37b 100644 --- a/lib/es6/map.js +++ b/lib/es6/map.js @@ -1,6 +1,7 @@ import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function Make(funarg) { let height = param => { @@ -37,11 +38,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -54,11 +53,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -72,11 +69,9 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -89,11 +84,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = param => { @@ -152,11 +145,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = funarg.compare(x, param.v); if (c === 0) { @@ -170,11 +159,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -246,11 +231,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -350,11 +331,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -388,11 +365,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -424,11 +397,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -717,15 +688,13 @@ function Make(funarg) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/lib/es6/mapLabels.js b/lib/es6/mapLabels.js index c791c85f85..b92a567fe6 100644 --- a/lib/es6/mapLabels.js +++ b/lib/es6/mapLabels.js @@ -1,6 +1,7 @@ import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function Make(Ord) { let height = param => { @@ -37,11 +38,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -54,11 +53,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -72,11 +69,9 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -89,11 +84,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = param => { @@ -152,11 +145,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Ord.compare(x, param.v); if (c === 0) { @@ -192,11 +181,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -268,11 +253,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -350,11 +331,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -388,11 +365,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -424,11 +397,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -717,15 +688,13 @@ function Make(Ord) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/lib/es6/moreLabels.js b/lib/es6/moreLabels.js index 5ab48c2721..0b882a7d36 100644 --- a/lib/es6/moreLabels.js +++ b/lib/es6/moreLabels.js @@ -3,6 +3,7 @@ import * as List from "./list.js"; import * as Caml_option from "./caml_option.js"; import * as HashtblLabels from "./hashtblLabels.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; let Hashtbl = { create: HashtblLabels.create, @@ -67,11 +68,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -84,11 +83,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -102,11 +99,9 @@ let $$Map = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -119,11 +114,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = param => { @@ -182,11 +175,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = funarg.compare(x, param.v); if (c === 0) { @@ -222,11 +211,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -298,11 +283,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -380,11 +361,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -418,11 +395,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -454,11 +427,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -747,15 +718,13 @@ let $$Map = { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ] }); } let v2 = s2.v; @@ -1011,11 +980,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -1027,11 +994,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -1044,11 +1009,9 @@ let $$Set = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -1060,11 +1023,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, param) => { @@ -1141,11 +1102,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -1173,11 +1130,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -1203,11 +1156,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -1598,11 +1549,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = funarg.compare(x, v); @@ -1634,11 +1581,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1700,11 +1643,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1874,15 +1813,13 @@ let $$Set = { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ] }); }; return sub(List.length(l), l)[0]; diff --git a/lib/es6/parsing.js b/lib/es6/parsing.js index c2eb456f4f..54637b2a9e 100644 --- a/lib/es6/parsing.js +++ b/lib/es6/parsing.js @@ -85,11 +85,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); case "Grow_stacks_1" : grow_stacks(); _arg = undefined; @@ -108,16 +104,14 @@ function yyparse(tables, start, lexer, lexbuf) { Caml_array.get(tables.actions, env.rule_number)(env) ]; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Parse_error) { match$1 = [ "Error_detected", undefined ]; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } _arg = match$1[1]; @@ -131,7 +125,7 @@ function yyparse(tables, start, lexer, lexbuf) { } }; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); let curr_char = env.curr_char; env.asp = init_asp; env.sp = init_sp; @@ -150,9 +144,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..94ee88a58c 100644 --- a/lib/es6/pervasives.js +++ b/lib/es6/pervasives.js @@ -7,20 +7,16 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: s }); } function invalid_arg(s) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } @@ -58,11 +54,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "char_of_int" }); } return n; @@ -83,11 +77,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "bool_of_string" }); } } @@ -107,13 +99,11 @@ function int_of_string_opt(s) { try { return Caml_format.int_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -149,13 +139,11 @@ function float_of_string_opt(s) { try { return Caml_format.float_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..b79c18a9a9 100644 --- a/lib/es6/queue.js +++ b/lib/es6/queue.js @@ -1,6 +1,7 @@ import * as Caml_exceptions from "./caml_exceptions.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; let Empty = /* @__PURE__ */Caml_exceptions.create("Queue.Empty"); @@ -41,21 +42,13 @@ function peek(q) { if (typeof match === "object") { return match.content; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } function take(q) { let match = q.first; if (typeof match !== "object") { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } let content = match.content; let next = match.next; diff --git a/lib/es6/random.js b/lib/es6/random.js index eecb439f2f..186ea7a2dc 100644 --- a/lib/es6/random.js +++ b/lib/es6/random.js @@ -8,6 +8,7 @@ import * as Digest from "./digest.js"; import * as Caml_array from "./caml_array.js"; import * as Caml_int64 from "./caml_int64.js"; import * as Caml_string from "./caml_string.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function random_seed() { return [(Math.floor(Math.random()*0x7fffffff))]; @@ -71,11 +72,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Random.int" }); } while (true) { @@ -90,11 +89,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32" }); } while (true) { @@ -111,11 +108,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64" }); } while (true) { diff --git a/lib/es6/runtime_deriving.js b/lib/es6/runtime_deriving.js index 36b9eb01d8..35296c94e7 100644 --- a/lib/es6/runtime_deriving.js +++ b/lib/es6/runtime_deriving.js @@ -1,13 +1,10 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function raiseWhenNotFound(x) { if (x == null) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } return x; } diff --git a/lib/es6/set.js b/lib/es6/set.js index 214de70318..28d4986221 100644 --- a/lib/es6/set.js +++ b/lib/es6/set.js @@ -2,6 +2,7 @@ import * as List from "./list.js"; import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function Make(funarg) { let height = param => { @@ -31,11 +32,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -47,11 +46,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -64,11 +61,9 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -80,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, param) => { @@ -161,11 +154,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -193,11 +182,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -223,11 +208,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -616,11 +599,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = funarg.compare(x, v); @@ -635,11 +614,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -699,11 +674,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -906,15 +877,13 @@ function Make(funarg) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ] }); }; return sub(List.length(l$1), l$1)[0]; diff --git a/lib/es6/setLabels.js b/lib/es6/setLabels.js index 604cad1ec7..88a0dc4da2 100644 --- a/lib/es6/setLabels.js +++ b/lib/es6/setLabels.js @@ -2,6 +2,7 @@ import * as List from "./list.js"; import * as Caml_option from "./caml_option.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function Make(Ord) { let height = param => { @@ -31,11 +32,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -47,11 +46,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -64,11 +61,9 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -80,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, param) => { @@ -161,11 +154,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -193,11 +182,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -223,11 +208,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -618,11 +601,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = Ord.compare(x, v); @@ -654,11 +633,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -720,11 +695,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -894,15 +865,13 @@ function Make(Ord) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ] }); }; return sub(List.length(l), l)[0]; diff --git a/lib/es6/sort.js b/lib/es6/sort.js index 98d609d6e5..fb5fef77a0 100644 --- a/lib/es6/sort.js +++ b/lib/es6/sort.js @@ -1,5 +1,6 @@ +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function merge(order, l1, l2) { if (!l1) { @@ -114,11 +115,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Sort.array" }); } while (i < j) { diff --git a/lib/es6/stack.js b/lib/es6/stack.js index 147171622d..4163f20841 100644 --- a/lib/es6/stack.js +++ b/lib/es6/stack.js @@ -2,6 +2,7 @@ import * as List from "./list.js"; import * as Caml_exceptions from "./caml_exceptions.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; let Empty = /* @__PURE__ */Caml_exceptions.create("Stack.Empty"); @@ -39,11 +40,7 @@ function pop(s) { s.len = s.len - 1 | 0; return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } function top(s) { @@ -51,11 +48,7 @@ function top(s) { if (match) { return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } function is_empty(s) { diff --git a/lib/es6/stream.js b/lib/es6/stream.js index 2ed7fbfc14..28352e3bce 100644 --- a/lib/es6/stream.js +++ b/lib/es6/stream.js @@ -6,6 +6,7 @@ import * as Caml_option from "./caml_option.js"; import * as Caml_string from "./caml_string.js"; import * as Caml_exceptions from "./caml_exceptions.js"; import * as CamlinternalLazy from "./camlinternalLazy.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; let Failure = /* @__PURE__ */Caml_exceptions.create("Stream.Failure"); @@ -54,15 +55,13 @@ function get_data(count, _d) { } }; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stream.res", - 53, - 13 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 53, + 13 + ] }); case "Slazy" : _d = CamlinternalLazy.force(d._0); @@ -116,15 +115,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 83, + 13 + ] }); case "Slazy" : s.data = CamlinternalLazy.force(f._0); @@ -234,11 +231,7 @@ function next(s) { junk(s); return Caml_option.valFromOption(a); } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Failure); } function empty(s) { @@ -246,11 +239,7 @@ function empty(s) { if (match === undefined) { return; } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Failure); } function iter(f, strm) { diff --git a/lib/es6/string.js b/lib/es6/string.js index 85e4d17c82..d0168b464f 100644 --- a/lib/es6/string.js +++ b/lib/es6/string.js @@ -90,11 +90,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -129,11 +125,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -142,11 +136,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -156,11 +148,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -176,11 +164,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -206,11 +192,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -219,24 +203,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -246,24 +226,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..eecc44d92f 100644 --- a/lib/es6/stringLabels.js +++ b/lib/es6/stringLabels.js @@ -92,11 +92,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -131,11 +127,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -144,11 +138,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -158,11 +150,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -178,11 +166,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -208,11 +194,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -221,24 +205,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -248,24 +228,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..6a1db30022 100644 --- a/lib/es6/uchar.js +++ b/lib/es6/uchar.js @@ -2,6 +2,7 @@ import * as Caml from "./caml.js"; import * as Caml_format from "./caml_format.js"; +import * as Caml_js_exceptions from "./caml_js_exceptions.js"; function err_not_sv(i) { return Caml_format.format_int("%X", i) + " is not an Unicode scalar value"; @@ -16,11 +17,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor" }); } return u + 1 | 0; @@ -31,11 +30,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor" }); } return u - 1 | 0; @@ -56,11 +53,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } @@ -77,11 +72,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } diff --git a/lib/js/arg.js b/lib/js/arg.js index 89c4a76246..dcbeb3a8b8 100644 --- a/lib/js/arg.js +++ b/lib/js/arg.js @@ -31,11 +31,7 @@ function assoc3(x, _l) { _l = l.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -57,13 +53,11 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: "-help" } }); } @@ -74,7 +68,7 @@ function add_help(speclist) { assoc3("-help", speclist); add1 = /* [] */0; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { add1 = { hd: [ @@ -88,9 +82,7 @@ function add_help(speclist) { tl: /* [] */0 }; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } let add2; @@ -98,7 +90,7 @@ function add_help(speclist) { assoc3("--help", speclist); add2 = /* [] */0; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); if (exn$1.RE_EXN_ID === "Not_found") { add2 = { hd: [ @@ -112,9 +104,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)); @@ -155,13 +145,11 @@ function bool_of_string_opt(x) { try { return Pervasives.bool_of_string(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Invalid_argument") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -169,13 +157,11 @@ function int_of_string_opt(x) { try { return Caml_format.int_of_string(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -183,13 +169,11 @@ function float_of_string_opt(x) { try { return Caml_format.float_of_string(x); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -227,15 +211,15 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist TAG: "Unknown", _0: "--help" })) { - return { + return Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Help, _1: Buffer.contents(b) - }; + }); } else { - return { + return Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Bad, _1: Buffer.contents(b) - }; + }); } }; current.contents = current.contents + 1 | 0; @@ -250,7 +234,7 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist undefined ]; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { try { let match$1 = split(s); @@ -259,26 +243,20 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist match$1[1] ]; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Unknown", + _0: s } }); } - 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,15 +264,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: follow, + _2: "no argument" } }); }; @@ -305,13 +281,11 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Missing", + _0: s } }); }; @@ -333,15 +307,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg, + _2: "a boolean" } }); } @@ -367,15 +339,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$2, + _2: "an integer" } }); } @@ -386,15 +356,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$3, + _2: "an integer" } }); } @@ -405,15 +373,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$4, + _2: "a float" } }); } @@ -424,15 +390,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$5, + _2: "a float" } }); } @@ -446,15 +410,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stop, + _1: { + TAG: "Wrong", + _0: s, + _1: arg$6, + _2: "one of: " + make_symlist("", " ", "", symb) } }); case "Rest" : @@ -466,11 +428,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Arg.Expand is is only allowed with Arg.parse_and_expand_argv_dynamic" }); } let arg$7 = get_arg(); @@ -496,26 +456,17 @@ function parse_and_expand_argv_dynamic_aux(allow_expand, current, argv, speclist anonfun(s); } } catch (raw_m) { - let m = Caml_js_exceptions.internalToOCamlException(raw_m); + let m = Caml_js_exceptions.internalAnyToExn(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; }; @@ -543,7 +494,7 @@ function parse(l, f, msg) { try { return parse_argv(undefined, Sys.argv, l, f, msg); } catch (raw_msg) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg$1 = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); return Pervasives.exit(2); @@ -552,9 +503,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; } } @@ -562,7 +511,7 @@ function parse_dynamic(l, f, msg) { try { return parse_argv_dynamic(undefined, Sys.argv, l, f, msg); } catch (raw_msg) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg$1 = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); return Pervasives.exit(2); @@ -571,9 +520,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; } } @@ -590,7 +537,7 @@ function parse_expand(l, f, msg) { }; return parse_and_expand_argv_dynamic(current$1, argv, spec, f, msg); } catch (raw_msg) { - let msg$1 = Caml_js_exceptions.internalToOCamlException(raw_msg); + let msg$1 = Caml_js_exceptions.internalAnyToExn(raw_msg); if (msg$1.RE_EXN_ID === Bad) { console.log(msg$1._1); return Pervasives.exit(2); @@ -599,9 +546,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; } } @@ -624,7 +569,7 @@ function second_word(s) { try { n = $$String.index(s, /* '\t' */9); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { let exit = 0; let n$1; @@ -632,22 +577,18 @@ function second_word(s) { n$1 = $$String.index(s, /* ' ' */32); exit = 2; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); 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..733ca239fd 100644 --- a/lib/js/array.js +++ b/lib/js/array.js @@ -14,11 +14,9 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.init" }); } let res = Caml_array.make(l, f(0)); @@ -58,11 +56,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" }); } return Caml_array.sub(a, ofs, len); @@ -70,11 +66,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill" }); } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { @@ -84,11 +78,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" }); } Caml_array.blit(a1, ofs1, a2, ofs2, len); @@ -102,11 +94,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length" }); } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { @@ -130,11 +120,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length" }); } if (la === 0) { @@ -317,11 +305,9 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Bottom, + _1: i }); }; let trickle = (l, i, e) => { @@ -338,13 +324,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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) => { @@ -358,13 +342,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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,15 +354,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "array.res", + 321, + 4 + ] }); } if (cmp(Caml_array.get(a, father), e) >= 0) { diff --git a/lib/js/arrayLabels.js b/lib/js/arrayLabels.js index cc4be0533e..47ad100b53 100644 --- a/lib/js/arrayLabels.js +++ b/lib/js/arrayLabels.js @@ -14,11 +14,9 @@ function init(l, f) { return []; } if (l < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Array.init" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.init" }); } let res = Caml_array.make(l, f(0)); @@ -58,11 +56,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.sub" }); } return Caml_array.sub(a, ofs, len); @@ -70,11 +66,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.fill" }); } for (let i = ofs, i_finish = ofs + len | 0; i < i_finish; ++i) { @@ -84,11 +78,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.blit" }); } Caml_array.blit(a1, ofs1, a2, ofs2, len); @@ -102,11 +94,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.iter2: arrays must have the same length" }); } for (let i = 0, i_finish = a.length; i < i_finish; ++i) { @@ -130,11 +120,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Array.map2: arrays must have the same length" }); } if (la === 0) { @@ -317,11 +305,9 @@ function sort(cmp, a) { if (i31 < l) { return i31; } - throw new Error(Bottom, { - cause: { - RE_EXN_ID: Bottom, - _1: i - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Bottom, + _1: i }); }; let trickle = (l, i, e) => { @@ -338,13 +324,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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) => { @@ -358,13 +342,11 @@ function sort(cmp, a) { continue; }; } catch (raw_i) { - let i$2 = Caml_js_exceptions.internalToOCamlException(raw_i); + let i$2 = Caml_js_exceptions.internalAnyToExn(raw_i); 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,15 +354,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "arrayLabels.res", + 321, + 4 + ] }); } if (cmp(Caml_array.get(a, father), e) >= 0) { diff --git a/lib/js/belt_Array.js b/lib/js/belt_Array.js index db7b6440a2..c568f867e9 100644 --- a/lib/js/belt_Array.js +++ b/lib/js/belt_Array.js @@ -2,6 +2,7 @@ let Caml = require("./caml.js"); let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function get(arr, i) { if (i >= 0 && i < arr.length) { @@ -12,15 +13,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 36, + 2 + ] }); } return arr[i]; @@ -37,15 +36,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_Array.res", + 49, + 2 + ] }); } arr[i] = v; diff --git a/lib/js/belt_List.js b/lib/js/belt_List.js index 0cbe6919bc..ca6ad3a97c 100644 --- a/lib/js/belt_List.js +++ b/lib/js/belt_List.js @@ -3,6 +3,7 @@ let Belt_Array = require("./belt_Array.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function head(x) { if (x) { @@ -15,11 +16,7 @@ function headExn(x) { if (x) { return x.hd; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function tail(x) { @@ -33,11 +30,7 @@ function tailExn(x) { if (x) { return x.tl; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function add(xs, x) { @@ -71,11 +64,7 @@ function get(x, n) { function getExn(x, n) { if (n < 0) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let _x = x; let _n = n; @@ -90,11 +79,7 @@ function getExn(x, n) { _x = x$1.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/belt_MutableQueue.js b/lib/js/belt_MutableQueue.js index 99bec2dd73..7f2e50ed8d 100644 --- a/lib/js/belt_MutableQueue.js +++ b/lib/js/belt_MutableQueue.js @@ -1,6 +1,7 @@ 'use strict'; let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function make() { return { @@ -54,11 +55,7 @@ function peekExn(q) { if (v !== undefined) { return v.content; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function pop(q) { @@ -90,11 +87,7 @@ function popExn(q) { return x.content; } } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function popUndefined(q) { diff --git a/lib/js/belt_Option.js b/lib/js/belt_Option.js index cc15d6aeeb..0b38da4f1d 100644 --- a/lib/js/belt_Option.js +++ b/lib/js/belt_Option.js @@ -1,6 +1,7 @@ 'use strict'; let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function keep(opt, p) { if (opt !== undefined && p(Caml_option.valFromOption(opt))) { @@ -20,11 +21,7 @@ function getExn(x) { if (x !== undefined) { return Caml_option.valFromOption(x); } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function mapWithDefault(opt, $$default, f) { diff --git a/lib/js/belt_Result.js b/lib/js/belt_Result.js index accb607746..230a2b7aea 100644 --- a/lib/js/belt_Result.js +++ b/lib/js/belt_Result.js @@ -1,15 +1,12 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function getExn(x) { if (x.TAG === "Ok") { return x._0; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } function mapWithDefault(opt, $$default, f) { diff --git a/lib/js/belt_internalAVLset.js b/lib/js/belt_internalAVLset.js index bd0e013f01..b34463d5fc 100644 --- a/lib/js/belt_internalAVLset.js +++ b/lib/js/belt_internalAVLset.js @@ -2,6 +2,7 @@ let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function copy(n) { if (n !== undefined) { @@ -349,15 +350,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLset.res", + 310, + 4 + ] }); } checkInvariantInternal(l); @@ -700,11 +699,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/belt_internalAVLtree.js b/lib/js/belt_internalAVLtree.js index 825157acc4..f8a6631e2f 100644 --- a/lib/js/belt_internalAVLtree.js +++ b/lib/js/belt_internalAVLtree.js @@ -2,6 +2,7 @@ let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function treeHeight(n) { if (n !== undefined) { @@ -546,15 +547,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "belt_internalAVLtree.res", + 439, + 4 + ] }); } checkInvariantInternal(l); @@ -849,11 +848,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/belt_internalMapInt.js b/lib/js/belt_internalMapInt.js index 033567d0f4..a607c9bcfc 100644 --- a/lib/js/belt_internalMapInt.js +++ b/lib/js/belt_internalMapInt.js @@ -3,6 +3,7 @@ let Caml = require("./caml.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function add(t, x, data) { @@ -62,11 +63,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/belt_internalMapString.js b/lib/js/belt_internalMapString.js index 0db017ec4e..2243eda129 100644 --- a/lib/js/belt_internalMapString.js +++ b/lib/js/belt_internalMapString.js @@ -3,6 +3,7 @@ let Caml = require("./caml.js"); let Caml_option = require("./caml_option.js"); let Belt_SortArray = require("./belt_SortArray.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function add(t, x, data) { @@ -62,11 +63,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/belt_internalSetInt.js b/lib/js/belt_internalSetInt.js index d319345d87..f17df33037 100644 --- a/lib/js/belt_internalSetInt.js +++ b/lib/js/belt_internalSetInt.js @@ -1,6 +1,7 @@ 'use strict'; let Belt_SortArrayInt = require("./belt_SortArrayInt.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Belt_internalAVLset = require("./belt_internalAVLset.js"); function has(_t, x) { @@ -141,11 +142,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/belt_internalSetString.js b/lib/js/belt_internalSetString.js index de811887c7..ef1ded8132 100644 --- a/lib/js/belt_internalSetString.js +++ b/lib/js/belt_internalSetString.js @@ -1,5 +1,6 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Belt_internalAVLset = require("./belt_internalAVLset.js"); let Belt_SortArrayString = require("./belt_SortArrayString.js"); @@ -141,11 +142,7 @@ function getExn(_n, x) { _n = x < v ? n.l : n.r; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } diff --git a/lib/js/buffer.js b/lib/js/buffer.js index c59f4ffe76..a2b7765681 100644 --- a/lib/js/buffer.js +++ b/lib/js/buffer.js @@ -4,6 +4,7 @@ let Bytes = require("./bytes.js"); let $$String = require("./string.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_string = require("./caml_string.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function create(n) { let n$1 = n < 1 ? 1 : n; @@ -26,11 +27,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.sub" }); } return Bytes.sub_string(b.buffer, ofs, len); @@ -38,11 +37,9 @@ function sub(b, 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.blit" }); } Bytes.blit(src.buffer, srcoff, dst, dstoff, len); @@ -50,11 +47,9 @@ function blit(src, 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.nth" }); } return b.buffer[ofs]; @@ -98,15 +93,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 98, + 18 + ] }); } if (u$1 <= 127) { @@ -145,30 +138,26 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 127, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 132, + 18 + ] }); } if (u$1 <= 65535) { @@ -196,30 +185,26 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 154, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 159, + 18 + ] }); } if (u$1 <= 65535) { @@ -247,25 +232,21 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 181, + 9 + ] }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.add_substring/add_subbytes" }); } let new_position = b.position + len | 0; @@ -305,15 +286,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "buffer.res", + 216, + 9 + ] }); } @@ -325,11 +304,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (Caml_string.get(s, i) === opening) { _i = i + 1 | 0; @@ -383,11 +358,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Caml_string.get(s, start); if (c !== 40 && c !== 123) { @@ -455,11 +426,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Buffer.truncate" }); } b.position = len; diff --git a/lib/js/bytes.js b/lib/js/bytes.js index b404268df9..5ab5770a79 100644 --- a/lib/js/bytes.js +++ b/lib/js/bytes.js @@ -110,11 +110,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub" }); } let r = Caml_bytes.create(len); @@ -138,22 +136,18 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } return c; @@ -180,11 +174,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" }); } unsafe_fill(s, ofs, len, c); @@ -192,11 +184,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" }); } unsafe_blit(s1, ofs1, s2, ofs2, len); @@ -204,11 +194,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" }); } if (len <= 0) { @@ -245,11 +233,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat" }); } @@ -489,11 +475,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -528,11 +510,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -541,11 +521,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -555,11 +533,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -575,11 +549,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -605,11 +577,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -618,24 +588,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,24 +611,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..5ab5770a79 100644 --- a/lib/js/bytesLabels.js +++ b/lib/js/bytesLabels.js @@ -110,11 +110,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.sub / Bytes.sub" }); } let r = Caml_bytes.create(len); @@ -138,22 +136,18 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } if (match$1) { return c; } if (match$2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Bytes.extend" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.extend" }); } return c; @@ -180,11 +174,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.fill / Bytes.fill" }); } unsafe_fill(s, ofs, len, c); @@ -192,11 +184,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.blit" }); } unsafe_blit(s1, ofs1, s2, ofs2, len); @@ -204,11 +194,9 @@ function 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.blit / Bytes.blit_string" }); } if (len <= 0) { @@ -245,11 +233,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Bytes.concat" }); } @@ -489,11 +475,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -528,11 +510,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -541,11 +521,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -555,11 +533,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s[i] === c) { return i; @@ -575,11 +549,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -605,11 +577,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -618,24 +588,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -645,24 +611,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..240fca3664 100644 --- a/lib/js/caml_array.js +++ b/lib/js/caml_array.js @@ -1,5 +1,6 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function sub(x, offset, len) { let result = new Array(len); @@ -57,11 +58,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } xs[index] = newval; @@ -69,11 +68,9 @@ function set(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return xs[index]; diff --git a/lib/js/caml_bigint.js b/lib/js/caml_bigint.js index 30cda2d9ce..74d4bc7f85 100644 --- a/lib/js/caml_bigint.js +++ b/lib/js/caml_bigint.js @@ -1,24 +1,17 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function div(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw Caml_js_exceptions.internalMakeExn("Division_by_zero"); } return x / y; } function mod_(x, y) { if (y === 0n) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw Caml_js_exceptions.internalMakeExn("Division_by_zero"); } return x % y; } diff --git a/lib/js/caml_bytes.js b/lib/js/caml_bytes.js index b7909d1b9d..1e78a64362 100644 --- a/lib/js/caml_bytes.js +++ b/lib/js/caml_bytes.js @@ -1,13 +1,12 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } s[i] = ch; @@ -15,11 +14,9 @@ function set(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return s[i]; @@ -27,11 +24,9 @@ function get(s, i) { function create(len) { if (len < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "String.create" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.create" }); } let result = new Array(len); diff --git a/lib/js/caml_exceptions.js b/lib/js/caml_exceptions.js index cdff924b3f..d1152f6143 100644 --- a/lib/js/caml_exceptions.js +++ b/lib/js/caml_exceptions.js @@ -14,11 +14,11 @@ function create(str) { return str; } -function is_extension(e) { - if (e == null) { - return false; +function is_extension(any) { + if (any) { + return typeof any.RE_EXN_ID === "string"; } else { - return typeof e.RE_EXN_ID === "string"; + return false; } } diff --git a/lib/js/caml_format.js b/lib/js/caml_format.js index 7ec916dc57..61b7fb9d15 100644 --- a/lib/js/caml_format.js +++ b/lib/js/caml_format.js @@ -2,6 +2,7 @@ let Caml = require("./caml.js"); let Caml_int64 = require("./caml_int64.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function parse_digit(c) { if (c >= 65) { @@ -129,11 +130,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } let aux = (_acc, _k) => { @@ -150,20 +149,16 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } let acc$1 = base * acc + v; if (acc$1 > threshold) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "int_of_string" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } _k = k + 1 | 0; @@ -174,11 +169,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int_of_string" }); } return or_res; @@ -218,11 +211,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int64_of_string" }); } let aux = (_acc, _k) => { @@ -239,11 +230,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int64_of_string" }); } let acc$1 = Caml_int64.add(Caml_int64.mul(base, acc), v); @@ -258,11 +247,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "int64_of_string" }); } return or_res; @@ -290,11 +277,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "format_int: format too long" }); } let f = { @@ -777,10 +762,10 @@ let float_of_string = (function(s,exn){ }); function float_of_string$1(s) { - return float_of_string(s, { + return float_of_string(s, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: "float_of_string" - }); + })); } exports.format_float = format_float; diff --git a/lib/js/caml_int32.js b/lib/js/caml_int32.js index 8bb64e9cba..463f1a5be9 100644 --- a/lib/js/caml_int32.js +++ b/lib/js/caml_int32.js @@ -1,24 +1,17 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function div(x, y) { if (y === 0) { - throw new Error("Division_by_zero", { - cause: { - RE_EXN_ID: "Division_by_zero" - } - }); + throw Caml_js_exceptions.internalMakeExn("Division_by_zero"); } 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 Caml_js_exceptions.internalMakeExn("Division_by_zero"); } return x % y; } diff --git a/lib/js/caml_int64.js b/lib/js/caml_int64.js index dcb3f8e08c..e8cc6433e2 100644 --- a/lib/js/caml_int64.js +++ b/lib/js/caml_int64.js @@ -1,6 +1,7 @@ 'use strict'; let Caml = require("./caml.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function mk(lo, hi) { return [ @@ -383,11 +384,7 @@ 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 Caml_js_exceptions.internalMakeExn("Division_by_zero"); } 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..0a58a44bf5 100644 --- a/lib/js/caml_js_exceptions.js +++ b/lib/js/caml_js_exceptions.js @@ -1,20 +1,33 @@ 'use strict'; let Caml_option = require("./caml_option.js"); -let Caml_exceptions = require("./caml_exceptions.js"); let $$Error = "JsError"; -function internalToOCamlException(e) { - if (Caml_exceptions.is_extension(e.cause)) { - return e.cause; - } else { - return { - RE_EXN_ID: "JsError", - _1: e - }; +class RescriptError extends Error { + constructor(message) { + super(message); + this.RE_EXN_ID = message; } } +; + +function internalMakeExn(prim) { + return new RescriptError(prim); +} + +function internalFromExtension(_ext) { + return (Object.assign(new RescriptError(_ext.RE_EXN_ID), _ext)); +} + +function internalAnyToExn(any) { + if (any && typeof any.RE_EXN_ID === "string") { + return any; + } + let exn = new RescriptError("JsError"); + exn._1 = any; + return exn; +} function as_js_exn(exn) { if (exn.RE_EXN_ID === $$Error) { @@ -24,6 +37,8 @@ function as_js_exn(exn) { } exports.$$Error = $$Error; -exports.internalToOCamlException = internalToOCamlException; +exports.internalMakeExn = internalMakeExn; +exports.internalFromExtension = internalFromExtension; +exports.internalAnyToExn = internalAnyToExn; exports.as_js_exn = as_js_exn; -/* No side effect */ +/* Not a pure module */ diff --git a/lib/js/caml_lexer.js b/lib/js/caml_lexer.js index dfaf1adaca..cb7aab4158 100644 --- a/lib/js/caml_lexer.js +++ b/lib/js/caml_lexer.js @@ -1,5 +1,6 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); /***********************************************************************/ /* */ @@ -104,10 +105,10 @@ let caml_lex_engine_aux = (function (tbl, start_state, lexbuf, exn){ let empty_token_lit = "lexing: empty token"; function lex_engine(tbls, i, buf) { - return caml_lex_engine_aux(tbls, i, buf, { + return caml_lex_engine_aux(tbls, i, buf, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: empty_token_lit - }); + })); } /***********************************************/ @@ -245,10 +246,10 @@ let caml_new_lex_engine_aux = (function (tbl, start_state, lexbuf, exn) { }); function new_lex_engine(tbl, i, buf) { - return caml_new_lex_engine_aux(tbl, i, buf, { + return caml_new_lex_engine_aux(tbl, i, buf, Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: "Failure", _1: empty_token_lit - }); + })); } exports.lex_engine = lex_engine; diff --git a/lib/js/caml_module.js b/lib/js/caml_module.js index b601cf66dd..059270b08a 100644 --- a/lib/js/caml_module.js +++ b/lib/js/caml_module.js @@ -1,14 +1,13 @@ 'use strict'; let Caml_obj = require("./caml_obj.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Undefined_recursive_module", + _1: loc }); }; let loop = (shape, struct_, idx) => { @@ -74,15 +73,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ] }); } if (shape.TAG === "Module") { @@ -94,15 +91,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "caml_module.res", + 109, + 9 + ] }); } diff --git a/lib/js/caml_obj.js b/lib/js/caml_obj.js index 0b3f182a11..af0132d8fc 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -1,6 +1,7 @@ 'use strict'; let Caml = require("./caml.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let for_in = (function(o,foo){ for (var x in o) { foo(x) }}); @@ -55,11 +56,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "compare: functional value" }); } break; @@ -136,11 +135,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value" }); } if (tag_a !== tag_b) { @@ -262,11 +259,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "equal: functional value" }); } if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { @@ -278,11 +273,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value" }); } if (tag_a !== tag_b) { diff --git a/lib/js/caml_string.js b/lib/js/caml_string.js index 252ba1b3fd..0d1bf223c1 100644 --- a/lib/js/caml_string.js +++ b/lib/js/caml_string.js @@ -1,13 +1,12 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "index out of bounds" }); } return s.codePointAt(i); diff --git a/lib/js/caml_sys.js b/lib/js/caml_sys.js index dae731f2ab..4db5c1b082 100644 --- a/lib/js/caml_sys.js +++ b/lib/js/caml_sys.js @@ -1,23 +1,16 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function sys_getenv(s) { if (typeof process === "undefined" || process.env === undefined) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let x = process.env[s]; if (x !== undefined) { return x; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let os_type = (function(_){ @@ -73,20 +66,16 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "sys_is_directory not implemented" }); } function sys_file_exists(_s) { - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "sys_file_exists not implemented" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "sys_file_exists not implemented" }); } diff --git a/lib/js/camlinternalLazy.js b/lib/js/camlinternalLazy.js index b92f4ac145..2218003d11 100644 --- a/lib/js/camlinternalLazy.js +++ b/lib/js/camlinternalLazy.js @@ -1,6 +1,7 @@ 'use strict'; let Caml_exceptions = require("./caml_exceptions.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function is_val(l) { return l.LAZY_DONE; @@ -16,11 +17,7 @@ function forward_with_closure(blk, closure) { } function raise_undefined() { - throw new Error(Undefined, { - cause: { - RE_EXN_ID: Undefined - } - }); + throw Caml_js_exceptions.internalMakeExn(Undefined); } function force(lzv) { @@ -33,13 +30,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..53b455bab3 100644 --- a/lib/js/char.js +++ b/lib/js/char.js @@ -1,14 +1,13 @@ 'use strict'; let Bytes = require("./bytes.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function chr(n) { if (n < 0 || n > 255) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Char.chr" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Char.chr" }); } return n; diff --git a/lib/js/digest.js b/lib/js/digest.js index 1630c5a8a8..0ef9d989a1 100644 --- a/lib/js/digest.js +++ b/lib/js/digest.js @@ -6,6 +6,7 @@ let $$String = require("./string.js"); let Caml_md5 = require("./caml_md5.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_string = require("./caml_string.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function string(str) { return Caml_md5.md5_string(str, 0, str.length); @@ -17,11 +18,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.substring" }); } return Caml_md5.md5_string(str, ofs, len); @@ -39,11 +38,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.to_hex" }); } let result = Caml_bytes.create(32); @@ -57,42 +54,34 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Digest.from_hex" }); } return c - /* '0' */48 | 0; diff --git a/lib/js/filename.js b/lib/js/filename.js index 293fb0b731..063c8539e4 100644 --- a/lib/js/filename.js +++ b/lib/js/filename.js @@ -119,13 +119,11 @@ let temp_dir_name; try { temp_dir_name = Caml_sys.sys_getenv("TMPDIR"); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { temp_dir_name = "/tmp"; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -201,13 +199,11 @@ let temp_dir_name$1; try { temp_dir_name$1 = Caml_sys.sys_getenv("TEMP"); } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); 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,11 +378,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_suffix" }); } return $$String.sub(name, 0, n); @@ -430,11 +424,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Filename.chop_extension" }); } return $$String.sub(name, 0, name.length - l | 0); diff --git a/lib/js/genlex.js b/lib/js/genlex.js index 0b989249f2..06b0d41a86 100644 --- a/lib/js/genlex.js +++ b/lib/js/genlex.js @@ -51,16 +51,14 @@ function make_lexer(keywords) { try { return Hashtbl.find(kwd_table, id); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return { TAG: "Ident", _0: id }; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let keyword_or_error = c => { @@ -68,18 +66,14 @@ function make_lexer(keywords) { try { return Hashtbl.find(kwd_table, s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "Illegal character " + s }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } }; let next_token = strm__ => { @@ -116,27 +110,21 @@ function make_lexer(keywords) { try { c$1 = char(strm__); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } - 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } Stream.junk(strm__); @@ -145,11 +133,9 @@ function make_lexer(keywords) { _0: c$1 }; } - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); case 40 : Stream.junk(strm__); @@ -471,18 +457,14 @@ function make_lexer(keywords) { try { c$1 = escape(strm__); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } store(c$1); continue; @@ -490,11 +472,7 @@ function make_lexer(keywords) { Stream.junk(strm__); return get_string(); } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); }; }; let char = strm__ => { @@ -508,25 +486,17 @@ function make_lexer(keywords) { try { return escape(strm__); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Stream.Failure) { - throw new Error(Stream.$$Error, { - cause: { - RE_EXN_ID: Stream.$$Error, - _1: "" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); } }; let escape = strm__ => { @@ -553,50 +523,38 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } 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 Caml_js_exceptions.internalFromExtension({ RE_EXN_ID: Stream.$$Error, _1: "" - } + }); + } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: Stream.$$Error, + _1: "" }); } Stream.junk(strm__); return c1; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); } }; let comment = strm__ => { @@ -617,11 +575,7 @@ function make_lexer(keywords) { return comment(strm__); } } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); case 42 : Stream.junk(strm__); while (true) { @@ -638,22 +592,14 @@ function make_lexer(keywords) { Stream.junk(strm__); return; } - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); }; default: Stream.junk(strm__); continue; } } else { - throw new Error(Stream.Failure, { - cause: { - RE_EXN_ID: Stream.Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Stream.Failure); } }; }; diff --git a/lib/js/hashtbl.js b/lib/js/hashtbl.js index b22fa9064a..8547d52389 100644 --- a/lib/js/hashtbl.js +++ b/lib/js/hashtbl.js @@ -9,6 +9,7 @@ let Caml_array = require("./caml_array.js"); let Pervasives = require("./pervasives.js"); let Caml_option = require("./caml_option.js"); let CamlinternalLazy = require("./camlinternalLazy.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function hash(x) { return Caml_hash.hash(10, 100, 0, x); @@ -109,15 +110,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "hashtbl.res", + 110, + 19 + ] }); } prec.next = r; @@ -252,11 +251,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k1 = match.key; let d1 = match.data; @@ -265,11 +260,7 @@ function find(h, key) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k2 = next1.key; let d2 = next1.data; @@ -278,11 +269,7 @@ function find(h, key) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k3 = next2.key; let d3 = next2.data; @@ -294,11 +281,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k = param.key; let data = param.data; @@ -468,14 +451,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 +504,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 +543,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 +625,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k1 = match.key; let d1 = match.data; @@ -667,11 +634,7 @@ function MakeSeeded(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k2 = next1.key; let d2 = next1.data; @@ -680,11 +643,7 @@ function MakeSeeded(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k3 = next2.key; let d3 = next2.data; @@ -696,11 +655,7 @@ function MakeSeeded(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k = param.key; let data = param.data; @@ -900,11 +855,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } let k1 = match.key; let d1 = match.data; @@ -913,11 +864,7 @@ function Make(H) { return d1; } if (typeof next1 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k2 = next1.key; let d2 = next1.data; @@ -926,11 +873,7 @@ function Make(H) { return d2; } if (typeof next2 !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k3 = next2.key; let d3 = next2.data; @@ -942,11 +885,7 @@ function Make(H) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let k = param.key; let data = param.data; diff --git a/lib/js/int32.js b/lib/js/int32.js index 00883d1909..9193aeb53e 100644 --- a/lib/js/int32.js +++ b/lib/js/int32.js @@ -32,13 +32,11 @@ function of_string_opt(s) { try { return Caml_format.int_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..954027b035 100644 --- a/lib/js/int64.js +++ b/lib/js/int64.js @@ -25,13 +25,11 @@ function of_string_opt(s) { try { return Caml_format.int64_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..59aa52f069 100644 --- a/lib/js/lexing.js +++ b/lib/js/lexing.js @@ -4,6 +4,7 @@ let Bytes = require("./bytes.js"); let Caml_array = require("./caml_array.js"); let Caml_bytes = require("./caml_bytes.js"); let Caml_lexer = require("./caml_lexer.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function engine(tbl, state, buf) { let result = Caml_lexer.lex_engine(tbl, state, buf); @@ -54,11 +55,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "Lexing.lex_refill: cannot grow buffer" }); } let newbuf = Caml_bytes.create(newlen); diff --git a/lib/js/list.js b/lib/js/list.js index cebd113d2d..2edc177ac4 100644 --- a/lib/js/list.js +++ b/lib/js/list.js @@ -3,6 +3,7 @@ let Caml_obj = require("./caml_obj.js"); let Pervasives = require("./pervasives.js"); let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function length(l) { let _len = 0; @@ -30,11 +31,9 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "hd" }); } @@ -42,21 +41,17 @@ function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "tl" }); } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -72,22 +67,18 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "nth" }); }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -156,11 +147,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.init" }); } if (len > 10000) { @@ -280,21 +269,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } @@ -316,19 +301,15 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } return accu; @@ -346,21 +327,17 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); }; } @@ -377,19 +354,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } return accu; @@ -401,19 +374,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } return accu; @@ -460,21 +429,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); }; } @@ -492,21 +457,17 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); }; } @@ -550,11 +511,7 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -584,11 +541,7 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -678,11 +631,7 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -790,21 +739,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } @@ -842,15 +787,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "list.res", + 420, + 11 + ] }); }; } diff --git a/lib/js/listLabels.js b/lib/js/listLabels.js index b026ab1ad4..0910ceda2e 100644 --- a/lib/js/listLabels.js +++ b/lib/js/listLabels.js @@ -3,6 +3,7 @@ let Caml_obj = require("./caml_obj.js"); let Pervasives = require("./pervasives.js"); let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function length(l) { let _len = 0; @@ -30,11 +31,9 @@ function hd(param) { if (param) { return param.hd; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "hd" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "hd" }); } @@ -42,21 +41,17 @@ function tl(param) { if (param) { return param.tl; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "tl" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "tl" }); } function nth(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -72,22 +67,18 @@ function nth(l, n) { _l = l$1.tl; continue; } - throw new Error("Failure", { - cause: { - RE_EXN_ID: "Failure", - _1: "nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: "nth" }); }; } function nth_opt(l, n) { if (n < 0) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.nth" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.nth" }); } let _l = l; @@ -156,11 +147,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.init" }); } if (len > 10000) { @@ -280,21 +269,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.map2" }); } @@ -316,19 +301,15 @@ function rev_map2(f, l1, l2) { }; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } if (l2$1) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.rev_map2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.rev_map2" }); } return accu; @@ -346,21 +327,17 @@ function iter2(f, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); } if (!l2) { return; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.iter2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.iter2" }); }; } @@ -377,19 +354,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_left2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_left2" }); } return accu; @@ -401,19 +374,15 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } if (l2) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.fold_right2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.fold_right2" }); } return accu; @@ -460,21 +429,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); } if (!l2) { return true; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.for_all2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.for_all2" }); }; } @@ -492,21 +457,17 @@ function exists2(p, _l1, _l2) { _l1 = l1.tl; continue; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); } if (!l2) { return false; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.exists2" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.exists2" }); }; } @@ -550,11 +511,7 @@ function assoc(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -584,11 +541,7 @@ function assq(x, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -678,11 +631,7 @@ function find(p, _param) { _param = param.tl; continue; } - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); }; } @@ -790,21 +739,17 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } if (!l2) { return /* [] */0; } - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "List.combine" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "List.combine" }); } @@ -842,15 +787,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "listLabels.res", + 420, + 11 + ] }); }; } diff --git a/lib/js/map.js b/lib/js/map.js index 3588ee0024..efefc726d5 100644 --- a/lib/js/map.js +++ b/lib/js/map.js @@ -1,6 +1,7 @@ 'use strict'; let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function Make(funarg) { let height = param => { @@ -37,11 +38,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -54,11 +53,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -72,11 +69,9 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -89,11 +84,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = param => { @@ -152,11 +145,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = funarg.compare(x, param.v); if (c === 0) { @@ -170,11 +159,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -246,11 +231,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -350,11 +331,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -388,11 +365,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -424,11 +397,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -717,15 +688,13 @@ function Make(funarg) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "map.res", - 552, - 11 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "map.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/lib/js/mapLabels.js b/lib/js/mapLabels.js index 4094b6e60e..6c7d29647d 100644 --- a/lib/js/mapLabels.js +++ b/lib/js/mapLabels.js @@ -1,6 +1,7 @@ 'use strict'; let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function Make(Ord) { let height = param => { @@ -37,11 +38,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -54,11 +53,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -72,11 +69,9 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -89,11 +84,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = param => { @@ -152,11 +145,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = Ord.compare(x, param.v); if (c === 0) { @@ -192,11 +181,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -268,11 +253,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -350,11 +331,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -388,11 +365,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -424,11 +397,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -717,15 +688,13 @@ function Make(Ord) { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ] }); } let v2 = s2.v; diff --git a/lib/js/moreLabels.js b/lib/js/moreLabels.js index fdbe98c04b..9f48f231e8 100644 --- a/lib/js/moreLabels.js +++ b/lib/js/moreLabels.js @@ -3,6 +3,7 @@ let List = require("./list.js"); let Caml_option = require("./caml_option.js"); let HashtblLabels = require("./hashtblLabels.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Hashtbl = { create: HashtblLabels.create, @@ -67,11 +68,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let lr = l.r; @@ -84,11 +83,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -102,11 +99,9 @@ let $$Map = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Map.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); } let rr = r.r; @@ -119,11 +114,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.bal" }); }; let is_empty = param => { @@ -182,11 +175,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let c = funarg.compare(x, param.v); if (c === 0) { @@ -222,11 +211,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -298,11 +283,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -380,11 +361,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -418,11 +395,7 @@ let $$Map = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -454,11 +427,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Map.remove_min_elt" }); } let l = param.l; @@ -747,15 +718,13 @@ let $$Map = { } if (typeof s2 !== "object") { - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "mapLabels.res", - 552, - 11 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "mapLabels.res", + 552, + 11 + ] }); } let v2 = s2.v; @@ -1011,11 +980,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -1027,11 +994,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -1044,11 +1009,9 @@ let $$Set = { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -1060,11 +1023,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, param) => { @@ -1141,11 +1102,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -1173,11 +1130,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -1203,11 +1156,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -1598,11 +1549,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = funarg.compare(x, v); @@ -1634,11 +1581,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1700,11 +1643,7 @@ let $$Set = { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -1874,15 +1813,13 @@ let $$Set = { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ] }); }; return sub(List.length(l), l)[0]; diff --git a/lib/js/parsing.js b/lib/js/parsing.js index b4a3eef011..cad11a3f6f 100644 --- a/lib/js/parsing.js +++ b/lib/js/parsing.js @@ -85,11 +85,7 @@ 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 Caml_js_exceptions.internalMakeExn(Parse_error); case "Grow_stacks_1" : grow_stacks(); _arg = undefined; @@ -108,16 +104,14 @@ function yyparse(tables, start, lexer, lexbuf) { Caml_array.get(tables.actions, env.rule_number)(env) ]; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === Parse_error) { match$1 = [ "Error_detected", undefined ]; } else { - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } _arg = match$1[1]; @@ -131,7 +125,7 @@ function yyparse(tables, start, lexer, lexbuf) { } }; } catch (raw_exn$1) { - let exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1); + let exn$1 = Caml_js_exceptions.internalAnyToExn(raw_exn$1); let curr_char = env.curr_char; env.asp = init_asp; env.sp = init_sp; @@ -150,9 +144,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..809eb0090e 100644 --- a/lib/js/pervasives.js +++ b/lib/js/pervasives.js @@ -7,20 +7,16 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Failure", + _1: s }); } function invalid_arg(s) { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: s - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } @@ -58,11 +54,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "char_of_int" }); } return n; @@ -83,11 +77,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "bool_of_string" }); } } @@ -107,13 +99,11 @@ function int_of_string_opt(s) { try { return Caml_format.int_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Failure") { return; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -149,13 +139,11 @@ function float_of_string_opt(s) { try { return Caml_format.float_of_string(s); } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..e9769d05ec 100644 --- a/lib/js/queue.js +++ b/lib/js/queue.js @@ -1,6 +1,7 @@ 'use strict'; let Caml_exceptions = require("./caml_exceptions.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Empty = /* @__PURE__ */Caml_exceptions.create("Queue.Empty"); @@ -41,21 +42,13 @@ function peek(q) { if (typeof match === "object") { return match.content; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } function take(q) { let match = q.first; if (typeof match !== "object") { - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } let content = match.content; let next = match.next; diff --git a/lib/js/random.js b/lib/js/random.js index 0b844d4e69..c6684eb5b6 100644 --- a/lib/js/random.js +++ b/lib/js/random.js @@ -8,6 +8,7 @@ let Digest = require("./digest.js"); let Caml_array = require("./caml_array.js"); let Caml_int64 = require("./caml_int64.js"); let Caml_string = require("./caml_string.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function random_seed() { return [(Math.floor(Math.random()*0x7fffffff))]; @@ -71,11 +72,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Random.int" }); } while (true) { @@ -90,11 +89,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Random.int32" }); } while (true) { @@ -111,11 +108,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Random.int64" }); } while (true) { diff --git a/lib/js/runtime_deriving.js b/lib/js/runtime_deriving.js index 5b1bc5652f..3147cb5fc6 100644 --- a/lib/js/runtime_deriving.js +++ b/lib/js/runtime_deriving.js @@ -1,13 +1,10 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function raiseWhenNotFound(x) { if (x == null) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } return x; } diff --git a/lib/js/set.js b/lib/js/set.js index 3b5ca118c9..e91a12da01 100644 --- a/lib/js/set.js +++ b/lib/js/set.js @@ -2,6 +2,7 @@ let List = require("./list.js"); let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function Make(funarg) { let height = param => { @@ -31,11 +32,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -47,11 +46,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -64,11 +61,9 @@ function Make(funarg) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -80,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, param) => { @@ -161,11 +154,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -193,11 +182,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -223,11 +208,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -616,11 +599,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = funarg.compare(x, v); @@ -635,11 +614,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -699,11 +674,7 @@ function Make(funarg) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -906,15 +877,13 @@ function Make(funarg) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "set.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "set.res", + 691, + 20 + ] }); }; return sub(List.length(l$1), l$1)[0]; diff --git a/lib/js/setLabels.js b/lib/js/setLabels.js index 85c913e920..0c196b01b1 100644 --- a/lib/js/setLabels.js +++ b/lib/js/setLabels.js @@ -2,6 +2,7 @@ let List = require("./list.js"); let Caml_option = require("./caml_option.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function Make(Ord) { let height = param => { @@ -31,11 +32,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let lr = l.r; @@ -47,11 +46,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } if (hr <= (hl + 2 | 0)) { @@ -64,11 +61,9 @@ function Make(Ord) { }; } if (typeof r !== "object") { - throw new Error("Invalid_argument", { - cause: { - RE_EXN_ID: "Invalid_argument", - _1: "Set.bal" - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); } let rr = r.r; @@ -80,11 +75,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.bal" }); }; let add = (x, param) => { @@ -161,11 +154,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let l = param.l; if (typeof l !== "object") { @@ -193,11 +182,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let r = param.r; if (typeof r !== "object") { @@ -223,11 +208,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Set.remove_min_elt" }); } let l = param.l; @@ -618,11 +601,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; let c = Ord.compare(x, v); @@ -654,11 +633,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -720,11 +695,7 @@ function Make(Ord) { while (true) { let param = _param; if (typeof param !== "object") { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); + throw Caml_js_exceptions.internalMakeExn("Not_found"); } let v = param.v; if (f(v)) { @@ -894,15 +865,13 @@ function Make(Ord) { match$4[1] ]; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "setLabels.res", - 691, - 20 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "setLabels.res", + 691, + 20 + ] }); }; return sub(List.length(l), l)[0]; diff --git a/lib/js/sort.js b/lib/js/sort.js index d4556f5ccd..eff4699d11 100644 --- a/lib/js/sort.js +++ b/lib/js/sort.js @@ -1,5 +1,6 @@ 'use strict'; +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function merge(order, l1, l2) { if (!l1) { @@ -114,11 +115,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "Sort.array" }); } while (i < j) { diff --git a/lib/js/stack.js b/lib/js/stack.js index e90720d44c..a5c2dc6722 100644 --- a/lib/js/stack.js +++ b/lib/js/stack.js @@ -2,6 +2,7 @@ let List = require("./list.js"); let Caml_exceptions = require("./caml_exceptions.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Empty = /* @__PURE__ */Caml_exceptions.create("Stack.Empty"); @@ -39,11 +40,7 @@ function pop(s) { s.len = s.len - 1 | 0; return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } function top(s) { @@ -51,11 +48,7 @@ function top(s) { if (match) { return match.hd; } - throw new Error(Empty, { - cause: { - RE_EXN_ID: Empty - } - }); + throw Caml_js_exceptions.internalMakeExn(Empty); } function is_empty(s) { diff --git a/lib/js/stream.js b/lib/js/stream.js index ac7705230d..6c3aee4fd6 100644 --- a/lib/js/stream.js +++ b/lib/js/stream.js @@ -6,6 +6,7 @@ let Caml_option = require("./caml_option.js"); let Caml_string = require("./caml_string.js"); let Caml_exceptions = require("./caml_exceptions.js"); let CamlinternalLazy = require("./camlinternalLazy.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); let Failure = /* @__PURE__ */Caml_exceptions.create("Stream.Failure"); @@ -54,15 +55,13 @@ function get_data(count, _d) { } }; } - throw new Error("Assert_failure", { - cause: { - RE_EXN_ID: "Assert_failure", - _1: [ - "stream.res", - 53, - 13 - ] - } + throw Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 53, + 13 + ] }); case "Slazy" : _d = CamlinternalLazy.force(d._0); @@ -116,15 +115,13 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Assert_failure", + _1: [ + "stream.res", + 83, + 13 + ] }); case "Slazy" : s.data = CamlinternalLazy.force(f._0); @@ -234,11 +231,7 @@ function next(s) { junk(s); return Caml_option.valFromOption(a); } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Failure); } function empty(s) { @@ -246,11 +239,7 @@ function empty(s) { if (match === undefined) { return; } - throw new Error(Failure, { - cause: { - RE_EXN_ID: Failure - } - }); + throw Caml_js_exceptions.internalMakeExn(Failure); } function iter(f, strm) { diff --git a/lib/js/string.js b/lib/js/string.js index 7a0052196d..337548c9aa 100644 --- a/lib/js/string.js +++ b/lib/js/string.js @@ -90,11 +90,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -129,11 +125,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -142,11 +136,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -156,11 +148,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -176,11 +164,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -206,11 +192,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -219,24 +203,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -246,24 +226,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..0488eb559c 100644 --- a/lib/js/stringLabels.js +++ b/lib/js/stringLabels.js @@ -92,11 +92,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -131,11 +127,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from / Bytes.index_from" }); } return index_rec(s, l, i, c); @@ -144,11 +138,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.index_from_opt / Bytes.index_from_opt" }); } return index_rec_opt(s, l, i, c); @@ -158,11 +150,7 @@ 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 Caml_js_exceptions.internalMakeExn("Not_found"); } if (s.codePointAt(i) === c) { return i; @@ -178,11 +166,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from / Bytes.rindex_from" }); } return rindex_rec(s, i, c); @@ -208,11 +194,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rindex_from_opt / Bytes.rindex_from_opt" }); } return rindex_rec_opt(s, i, c); @@ -221,24 +205,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.contains_from / Bytes.contains_from" }); } try { index_rec(s, l, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); if (exn.RE_EXN_ID === "Not_found") { return false; } - throw new Error(exn.RE_EXN_ID, { - cause: exn - }); + throw exn; } } @@ -248,24 +228,20 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "String.rcontains_from / Bytes.rcontains_from" }); } try { rindex_rec(s, i, c); return true; } catch (raw_exn) { - let exn = Caml_js_exceptions.internalToOCamlException(raw_exn); + let exn = Caml_js_exceptions.internalAnyToExn(raw_exn); 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..dea7d680b7 100644 --- a/lib/js/uchar.js +++ b/lib/js/uchar.js @@ -2,6 +2,7 @@ let Caml = require("./caml.js"); let Caml_format = require("./caml_format.js"); +let Caml_js_exceptions = require("./caml_js_exceptions.js"); function err_not_sv(i) { return Caml_format.format_int("%X", i) + " is not an Unicode scalar value"; @@ -16,11 +17,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "U+10FFFF has no successor" }); } return u + 1 | 0; @@ -31,11 +30,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: "U+0000 has no predecessor" }); } return u - 1 | 0; @@ -56,11 +53,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); } @@ -77,11 +72,9 @@ 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 Caml_js_exceptions.internalFromExtension({ + RE_EXN_ID: "Invalid_argument", + _1: s }); }