Skip to content
Prev 54615 / 63424 Next

Better error message in loadNamespace

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