Open ekimekim opened 5 years ago
I see, it could be quite cool.
Perhaps it could be even more general and allow distinguishing between "your code" and "third party code" somehow (with stack trace reduced for third party code, not only for stdlib in particular).
Thanks for the suggestion!
Many of the functions in the stdlib result in a large number of stack frames.
In some circumstances, usage of foldl, comprehensions, etc, can cause the vast majority of a large stack trace to be std.jsonnet frames only.
In one example we've encountered, the stack trace looked like so:
which makes the actual problems in user code extremely difficult to find among the noise.
(this particular case was a format string error, similar to
"%(foo)s" % {bar: ""}
)Users are almost never interested in the details of the call path through
std.jsonnet
when debugging their code.It would be extremely handy to have an option to
evaluate_file()
(we're using the python bindings, but I'd expect this could be applied generally) to elide all but the first and last frame in a sequence ofstd.jsonnet
frames. The above stack trace would then look like:We can implement this ourselves in our tooling that wraps the
evaluate_file()
call, but it would be very handy to have supported by jsonnet natively.