Explorar el Código

remove all "Something went wrong" errors

Simon Krajewski hace 1 año
padre
commit
732be46cad

+ 1 - 1
src/generators/genjvm.ml

@@ -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

+ 5 - 4
src/generators/genshared.ml

@@ -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 =
@@ -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

+ 2 - 2
src/macro/eval/evalEmitter.ml

@@ -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]

+ 3 - 3
src/macro/eval/evalExceptions.ml

@@ -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
@@ -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

+ 1 - 1
src/macro/eval/evalJit.ml

@@ -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

+ 1 - 1
src/typing/matcher/texprConverter.ml

@@ -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