Fellow R developers,

I can capture usual error message using the normal way:
> tc <- tryCatch(1 + a, error = function(e) e)
> tc
<simpleError: object 'a' not found>

However I have troubles capturing the error message from this type of error:

> tc <- tryCatch(requireNamespace("foobar"), error = function(e) e)
Loading required namespace: foobar
Failed with error:  ‘there is no package called ‘foobar’’
> tc
[1] FALSE

Is there any way to capture that specific error message?

Thank you in advance,
Adrian

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to