Skip to content

Commit 9ec37af

Browse files
uberspotsparkprime
authored andcommitted
Fix #644: make string interpolation error msg clearer.
1 parent 0ecced5 commit 9ec37af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/std.jsonnet

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ limitations under the License.
660660
local tmp = if code.fw == '*' then {
661661
j: j + 1,
662662
fw: if j >= std.length(arr) then
663-
error 'Not enough values to format: ' + std.length(arr)
663+
error ('Not enough values to format: ' + std.length(arr) + ', expected at least ' + j)
664664
else
665665
arr[j],
666666
} else {
@@ -670,7 +670,7 @@ limitations under the License.
670670
local tmp2 = if code.prec == '*' then {
671671
j: tmp.j + 1,
672672
prec: if tmp.j >= std.length(arr) then
673-
error 'Not enough values to format: ' + std.length(arr)
673+
error ('Not enough values to format: ' + std.length(arr) + ', expected at least ' + tmp.j)
674674
else
675675
arr[tmp.j],
676676
} else {
@@ -682,7 +682,7 @@ limitations under the License.
682682
if j2 < std.length(arr) then
683683
arr[j2]
684684
else
685-
error 'Not enough values to format, got ' + std.length(arr);
685+
error ('Not enough values to format: ' + std.length(arr) + ', expected at least ' + j2);
686686
local s =
687687
if code.ctype == '%' then
688688
'%'

0 commit comments

Comments
 (0)