[Rd] capture error messages from loading shared objects

Adrian Dusa du@@@@dr|@n @end|ng |rom un|buc@ro
Tue Nov 28 10:46:45 CET 2023


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]]



More information about the R-devel mailing list