From thomasp85 at gmail.com  Mon Jan 22 14:32:27 2018
From: thomasp85 at gmail.com (Thomas Lin Pedersen)
Date: Mon, 22 Jan 2018 14:32:27 +0100
Subject: [Rd] Better error message in loadNamespace
Message-ID: <A8C1E0B5-960D-4397-BCFD-288AF32F4A6B@gmail.com>

Hi

I?ve just spend a bit of time debugging an error arising in `loadNamespace`. The bottom line is that the `vI` object is assigned within an `if` block but expected to exist for all of the remaining code. In some cases where the package library has been corrupted or when it resides on a network drive with bad connection this can lead to error messages complaining about `vI` object not existing. Debugging through the error is difficult, both because `loadNamespace` is called recursively through the dependency graph and the error can arise at any depth. And because the recursive calls are wrapped in `try` so the code breaks some distance from the point where the error occurred.

I will suggest mitigating this by adding an `else` clause to the `if` block where `vI` gets assigned that warns about potential corruption of the library and names the package that caused the error.

I can open a bug report if you wish, but I would require a bugzilla account for that. Otherwise you?re also welcome to take it from here.

With best wishes
Thomas Lin Pedersen


[Rd] Better error message in loadNamespace
Thomas Lin Pedersen