Provide function to rethrow conditions while keeping the original condition and call stack
Use cases:
- Wrap technical errors to present end-user-friendly errors (e. g. in shiny apps or other UIs)
Mainly important for errors and warnings...
Possible signature:
rethrow <- function(condition, message = condition.msg, custom.class, ...)
The rethrown condition inherits the classes of the condition argument
but belongs to an additional rethrow* class to make it easy to recognize
as rethrown condition and to extract the additional information like
call.stack, original (wrapped) condition, custom error number...
See also:
- https://stackoverflow.com/a/12676695
- https://github.com/aryoda/tryCatchLog/issues/33#issuecomment-431936232
I think it is impossible to implement this in a lean way currently for error conditions since they cannot be silenced and always bubble-up to all handlers for that.
"Rethrow" would require to silence the error and throw another condition instead.
I tend to reject these feature request (even I love the idea behind it quite well - at least for application programming with user interfaces)...