From ed252b4c06e1431aa98f07203127051b58bc17d5 Mon Sep 17 00:00:00 2001 From: Jarvis Carroll Date: Tue, 12 May 2026 06:07:58 +0000 Subject: [PATCH] Also note index in record_element I changed it from noting the index to just noting the field name, but actually both pieces of information are important, since if there was a type error, presumably the type information is actually wrong. Now we put the index first, since that is the part of the FATE tuple that failed, and then the field name that that would be if the type information were correct, in case that is useful. --- src/hz_aaci.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hz_aaci.erl b/src/hz_aaci.erl index 1313b9b..ebf1c6a 100644 --- a/src/hz_aaci.erl +++ b/src/hz_aaci.erl @@ -832,7 +832,7 @@ coerce_record_to_map(O, N, MemberTypes, Tuple) -> correct_record_error_paths(Names, Errors) -> CorrectOne = fun({Error, [{record_element, N} | Path]}) -> FieldName = lists:nth(N + 1, Names), - {Error, [{record_element, FieldName} | Path]} + {Error, [{record_element, N, FieldName} | Path]} end, Corrected = lists:map(CorrectOne, Errors), {error, Corrected}. @@ -1169,7 +1169,7 @@ singleton_record_substitution_test() -> check_roundtrip(HOutput, #{"it" => {123, 456}}, {tuple, {123, 456}}), % Also check that records have accurate paths, since the implementation for % record error paths is a bit fiddly. - {error, [{{tuple_too_many_terms, _, _, _}, [{record_element, "it"}]}]} = fate_to_erlang(HOutput, {tuple, {1, 2, 3}}). + {error, [{{tuple_too_many_terms, _, _, _}, [{record_element, 0, "it"}]}]} = fate_to_erlang(HOutput, {tuple, {1, 2, 3}}). tuple_substitution_test() -> Contract = "