File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ abstract class Materializer {
3737 )
3838 if (sort) {
3939 if (prevKey != null && k.compareTo(prevKey) <= 0 )
40- Error .fail(s """ Internal error: Unexpected key " $k" after " $prevKey" in sorted object materialization """ )
40+ Error .fail(
41+ s """ Internal error: Unexpected key " $k" after " $prevKey" in sorted object materialization """ , v.pos)
4142 prevKey = k
4243 }
4344 }
@@ -56,14 +57,14 @@ abstract class Materializer {
5657 case Val .True (pos) => storePos(pos); visitor.visitTrue(- 1 )
5758 case Val .False (pos) => storePos(pos); visitor.visitFalse(- 1 )
5859 case Val .Null (pos) => storePos(pos); visitor.visitNull(- 1 )
59- case _ : Val .Func =>
60- Error .fail(" Couldn't manifest function as JSON " )
60+ case s : Val .Func =>
61+ Error .fail(" Couldn't manifest function with params [ " + s.params.names.mkString( " , " ) + " ] " , v.pos )
6162 case _ =>
62- Error .fail(" Unknown value type " + v.prettyName )
63+ Error .fail(" Unknown value type" , v.pos )
6364 }
6465 } catch {
6566 case _ : StackOverflowError =>
66- Error .fail(" Stackoverflow while materializing, possibly due to recursive value" )
67+ Error .fail(" Stackoverflow while materializing, possibly due to recursive value" , v.pos )
6768 }
6869
6970 def reverse (pos : Position , v : ujson.Value ): Val = v match {
Original file line number Diff line number Diff line change @@ -23,14 +23,17 @@ object ErrorTestsJvmOnly extends TestSuite {
2323 val tests = Tests {
2424 test(" array_recursive_manifest" ) - check(
2525 """ sjsonnet.Error: Stackoverflow while materializing, possibly due to recursive value
26+ | at .(sjsonnet/test/resources/test_suite/error.array_recursive_manifest.jsonnet:17:12)
2627 |""" .stripMargin
2728 )
2829 test(" obj_recursive" ) - check(
2930 """ sjsonnet.Error: Stackoverflow while materializing, possibly due to recursive value
31+ | at .(sjsonnet/test/resources/test_suite/error.obj_recursive.jsonnet:17:3)
3032 |""" .stripMargin
3133 )
3234 test(" obj_recursive_manifest" ) - check(
3335 """ sjsonnet.Error: Stackoverflow while materializing, possibly due to recursive value
36+ | at .(sjsonnet/test/resources/test_suite/error.obj_recursive_manifest.jsonnet:17:3)
3437 |""" .stripMargin
3538 )
3639 }
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ object EvaluatorTests extends TestSuite{
3030 eval(" local f(x) = function() true; f(42)" ) ==> ujson.True
3131 eval(" local f(x) = function() true; f(42) == true" ) ==> ujson.False
3232 eval(" local f(x) = function() true; f(42)() == true" ) ==> ujson.True
33- assert(evalErr(" {foo: function() true}" ).startsWith(" sjsonnet.Error: Couldn't manifest function as JSON " ))
33+ assert(evalErr(" {foo: function() true}" ).startsWith(" sjsonnet.Error: Couldn't manifest function with params " ))
3434 eval(" {foo: (function() true)()}" ) ==> ujson.Obj {" foo" -> ujson.True }
3535 }
3636 test(" members" ) {
You can’t perform that action at this time.
0 commit comments