erg
erg copied to clipboard
Better error indication
f x =
...
y = foo.try_some(x)?
...
g x =
y = f(x)?
...
i = g(1)?
Suppose you get the following error in the above code (including omissions).
Traceback (most recent call first):
...
Foo.try_some, line ..., file "..."
.... | y = foo.try_some(x)?
module::f, line ..., file "..."
.... | y = f(x)?
module::g, line ..., file "..."
.... | i = g(1)?
Error: ...
How about displaying the contents and type of the variable to make the error message clearer? Like this:
Traceback (most recent call first):
...
Foo.try_some, line ..., file "..."
.... | y = foo.try_some(x)?
│ └ 1: Int
└ <Foo object>: Foo
module::f, line ..., file "..."
... | y = f(x)?
└ 1: Int
module::g, line ..., file "..."
... | i = g(1)?
Error: ...