@@ -244,7 +244,7 @@ func DiscoverExternalPlugins(filesystem afero.Fs) (ps []plugin.Plugin, err error
244
244
pluginsRoot , err := retrievePluginsRoot (runtime .GOOS )
245
245
if err != nil {
246
246
logrus .Errorf ("could not get plugins root: %v" , err )
247
- return nil , err
247
+ return nil , fmt . Errorf ( "could not get plugins root: %w" , err )
248
248
}
249
249
250
250
rootInfo , err := filesystem .Stat (pluginsRoot )
@@ -253,7 +253,7 @@ func DiscoverExternalPlugins(filesystem afero.Fs) (ps []plugin.Plugin, err error
253
253
logrus .Debugf ("External plugins dir %q does not exist, skipping external plugin parsing" , pluginsRoot )
254
254
return nil , nil
255
255
}
256
- return nil , err
256
+ return nil , fmt . Errorf ( "error getting stats for plugins %s: %w" , pluginsRoot , err )
257
257
}
258
258
if ! rootInfo .IsDir () {
259
259
logrus .Debugf ("External plugins path %q is not a directory, skipping external plugin parsing" , pluginsRoot )
@@ -262,7 +262,7 @@ func DiscoverExternalPlugins(filesystem afero.Fs) (ps []plugin.Plugin, err error
262
262
263
263
pluginInfos , err := afero .ReadDir (filesystem , pluginsRoot )
264
264
if err != nil {
265
- return nil , err
265
+ return nil , fmt . Errorf ( "error reading plugins directory %q: %w" , pluginsRoot , err )
266
266
}
267
267
268
268
for _ , pluginInfo := range pluginInfos {
@@ -273,7 +273,8 @@ func DiscoverExternalPlugins(filesystem afero.Fs) (ps []plugin.Plugin, err error
273
273
274
274
versions , err := afero .ReadDir (filesystem , filepath .Join (pluginsRoot , pluginInfo .Name ()))
275
275
if err != nil {
276
- return nil , err
276
+ return nil , fmt .Errorf ("error reading plugin directory %s: %w" ,
277
+ filepath .Join (pluginsRoot , pluginInfo .Name ()), err )
277
278
}
278
279
279
280
for _ , version := range versions {
@@ -284,7 +285,8 @@ func DiscoverExternalPlugins(filesystem afero.Fs) (ps []plugin.Plugin, err error
284
285
285
286
pluginFiles , err := afero .ReadDir (filesystem , filepath .Join (pluginsRoot , pluginInfo .Name (), version .Name ()))
286
287
if err != nil {
287
- return nil , err
288
+ return nil , fmt .Errorf ("error reading plugion version directory %q: %w" ,
289
+ filepath .Join (pluginsRoot , pluginInfo .Name (), version .Name ()), err )
288
290
}
289
291
290
292
for _ , pluginFile := range pluginFiles {
@@ -310,8 +312,8 @@ func DiscoverExternalPlugins(filesystem afero.Fs) (ps []plugin.Plugin, err error
310
312
Args : parseExternalPluginArgs (),
311
313
}
312
314
313
- if err : = ep .PVersion .Parse (version .Name ()); err != nil {
314
- return nil , err
315
+ if err = ep .PVersion .Parse (version .Name ()); err != nil {
316
+ return nil , fmt . Errorf ( "error parsing external plugin version %q: %w" , version . Name (), err )
315
317
}
316
318
317
319
logrus .Printf ("Adding external plugin: %s" , ep .Name ())
0 commit comments