@@ -812,16 +812,23 @@ public StarlarkList<?> dir(Object object, StarlarkThread thread) throws EvalExce
812
812
"Deprecated. Causes an optional prefix containing this string to be added to the"
813
813
+ " error message." ,
814
814
positional = false ,
815
- named = true )
815
+ named = true ),
816
+ @ Param (
817
+ name = "sep" ,
818
+ defaultValue = "\" \" " ,
819
+ named = true ,
820
+ positional = false ,
821
+ doc = "The separator string between the objects, default is space (\" \" )." )
816
822
},
817
823
extraPositionals =
818
824
@ Param (
819
825
name = "args" ,
820
826
doc =
821
827
"A list of values, formatted with debugPrint (which is equivalent to str by"
822
- + " default) and joined with spaces, that appear in the error message." ),
828
+ + " default) and joined with sep (defaults to \" \" ), that appear in the"
829
+ + " error message." ),
823
830
useStarlarkThread = true )
824
- public void fail (Object msg , Object attr , Tuple args , StarlarkThread thread )
831
+ public void fail (Object msg , Object attr , String sep , Tuple args , StarlarkThread thread )
825
832
throws EvalException {
826
833
Printer printer = new Printer ();
827
834
boolean needSeparator = false ;
@@ -832,14 +839,14 @@ public void fail(Object msg, Object attr, Tuple args, StarlarkThread thread)
832
839
// msg acts like a leading element of args.
833
840
if (msg != Starlark .NONE ) {
834
841
if (needSeparator ) {
835
- printer .append (" " );
842
+ printer .append (sep );
836
843
}
837
844
printer .debugPrint (msg , thread .getSemantics ());
838
845
needSeparator = true ;
839
846
}
840
847
for (Object arg : args ) {
841
848
if (needSeparator ) {
842
- printer .append (" " );
849
+ printer .append (sep );
843
850
}
844
851
printer .debugPrint (arg , thread .getSemantics ());
845
852
needSeparator = true ;
0 commit comments