Skip to content

Commit 1c6b849

Browse files
committed
Make missing plugin repo errors more informative
1 parent 253065a commit 1c6b849

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

internal/config/plugin_installer.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,22 @@ func (pr PluginRepository) Fetch(out io.Writer) PluginPackages {
155155
return PluginPackages{}
156156
}
157157
defer resp.Body.Close()
158+
159+
if resp.StatusCode != http.StatusOK {
160+
fmt.Fprintf(out, "Skipped: %s\n", pr)
161+
fmt.Fprintf(out, " Reason: Server error %d (%s)\n", resp.StatusCode,
162+
http.StatusText(resp.StatusCode))
163+
return nil
164+
}
165+
158166
decoder := json5.NewDecoder(resp.Body)
159167

160168
var plugins PluginPackages
161169
if err := decoder.Decode(&plugins); err != nil {
162-
fmt.Fprintln(out, "Failed to decode repository data:\n", err)
163-
return PluginPackages{}
170+
fmt.Fprintf(out, "Skipped: %s\n", pr)
171+
fmt.Fprintf(out, " Reason: Failed to decode repository data:\n")
172+
fmt.Fprintf(out, " %s\n", err)
173+
return nil
164174
}
165175
if len(plugins) > 0 {
166176
return PluginPackages{plugins[0]}

0 commit comments

Comments
 (0)