Skip to content

Commit

Permalink
remove all "Something went wrong" errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Feb 4, 2024
1 parent 8a255c8 commit 732be46
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/generators/genjvm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ class texpr_to_jvm
info.super_call_fields <- tl;
hd
| _ ->
Error.raise_typing_error "Something went wrong" e1.epos
Error.raise_typing_error "Could not find field information for super call, please report this" e1.epos
in
let kind = get_construction_mode c cf in
begin match kind with
Expand Down
9 changes: 5 additions & 4 deletions src/generators/genshared.ml
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ object(self)
| None -> die "" __LOC__
| Some(c,_) -> c,cf
in
let rec promote_this_before_super c cf = match self#get_field_info cf.cf_meta with
| None -> failwith "Something went wrong"
let rec promote_this_before_super c cf p = match self#get_field_info cf.cf_meta with
| None ->
Error.raise_typing_error (Printf.sprintf "Could not determine field information for %s in a this-before-super case, please report this" cf.cf_name) p
| Some info ->
if not info.has_this_before_super then begin
make_haxe cf;
(* print_endline (Printf.sprintf "promoted this_before_super to %s.new : %s" (s_type_path c.cl_path) (s_type (print_context()) cf.cf_type)); *)
info.has_this_before_super <- true;
List.iter (fun (c,cf) -> promote_this_before_super c cf) info.super_call_fields
List.iter (fun (c,cf) -> promote_this_before_super c cf p) info.super_call_fields
end
in
let rec loop e =
Expand All @@ -153,7 +154,7 @@ object(self)
(* print_endline (Printf.sprintf "inferred this_before_super on %s.new : %s" (s_type_path c.cl_path) (s_type (print_context()) cf.cf_type)); *)
end;
let c,cf = find_super_ctor el in
if !this_before_super then promote_this_before_super c cf;
if !this_before_super then promote_this_before_super c cf e.epos;
DynArray.add super_call_fields (c,cf);
| _ ->
Type.iter loop e
Expand Down
4 changes: 2 additions & 2 deletions src/macro/eval/evalEmitter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,8 @@ let process_arguments fl vl env =
loop fl []
| [],[] ->
()
| _ ->
exc_string "Something went wrong"
| l1,l2 ->
exc_string (Printf.sprintf "Bad number of arguments: %i vs. %i" (List.length l1) (List.length l2))
in
loop fl vl
[@@inline]
Expand Down
6 changes: 3 additions & 3 deletions src/macro/eval/evalExceptions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ let catch_exceptions ctx ?(final=(fun() -> ())) f p =
in
(Error.Custom (value_string v1), v2)
end else
Error.raise_typing_error "Something went wrong" null_pos
Error.raise_typing_error (Printf.sprintf "Unexpected value where haxe.macro.Error was expected: %s" (s_value 0 v).sstring) null_pos
) (EvalArray.to_list sub)
| _ -> []
in
Expand Down Expand Up @@ -165,8 +165,8 @@ let catch_exceptions ctx ?(final=(fun() -> ())) f p =
| [] -> Error.raise_msg s.sstring p
| _ -> Error.raise_error (Error.make_error ~sub:(List.map (fun (msg,p) -> Error.make_error msg p) stack) (Error.Custom s.sstring) p)
);
| _ ->
Error.raise_typing_error "Something went wrong" null_pos
| v ->
Error.raise_typing_error (Printf.sprintf "Invalid exception value where string was expected: %s" (s_value 0 v).sstring) null_pos
end else begin
(* Careful: We have to get the message before resetting the context because toString() might access it. *)
let stack = match eval_stack with
Expand Down
2 changes: 1 addition & 1 deletion src/macro/eval/evalJit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ and jit_expr jit return e =
List.iter (fun var -> ignore(get_capture_slot jit var)) jit_closure.captures_outside_scope;
let captures = ExtList.List.filter_map (fun (i,vid,declared) ->
if declared then None
else Some (i,fst (try Hashtbl.find jit.captures vid with Not_found -> Error.raise_typing_error "Something went wrong" e.epos))
else Some (i,fst (try Hashtbl.find jit.captures vid with Not_found -> Error.raise_typing_error (Printf.sprintf "Could not find capture variable %i" vid) e.epos))
) captures in
let mapping = Array.of_list captures in
emit_closure ctx mapping eci hasret exec fl
Expand Down
2 changes: 1 addition & 1 deletion src/typing/matcher/texprConverter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let constructor_to_texpr ctx con =
| ConArray i -> make_int ctx.com.basic i p
| ConTypeExpr mt -> TyperBase.type_module_type ctx mt p
| ConStatic(c,cf) -> make_static_field c cf p
| ConFields _ -> raise_typing_error "Something went wrong" p
| ConFields _ -> raise_typing_error "Unexpected matching on ConFields, please report this" p

let s_subject v_lookup s e =
let rec loop top s e = match e.eexpr with
Expand Down

0 comments on commit 732be46

Please sign in to comment.