Message-ID: <CAA1TD3qzysOEKsU51pTDd2yvdpH4=3NBsYwHMy0MLg-FCKnAKQ@mail.gmail.com>
Date: 2023-11-28T09:46:45Z
From: Adrian Dusa
Subject: capture error messages from loading shared objects
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]]