Closed denrou closed 7 years ago
I don't know of a good way to do this -- that's how R in general reports errors.
After encountering an error, you can use traceback()
to see the call stack, or you can set the error
option to call traceback()
so that it automatically shows the call stack at an error. This will only help for users that know how do this, though.
> x$lets_add("A")
Error in self$x + y : non-numeric argument to binary operator
> traceback()
1: x$lets_add("A")
>
> options(error = function() traceback(3))
> x$lets_add("A")
Error in self$x + y : non-numeric argument to binary operator
1: x$lets_add("A")
Hi,
Consider this simple class:
now if I do
everything runs smoothly. But sometimes I make some mistakes:
The error is the same as the one returned by
1 + "A"
. I was wondering if we could imagine a catch mechanism onR6
class for the errors to be more exhaustive. For example, we could return: