From 70acfb2cfd942d75eb0fc75ef610d909a8d26c3e Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 21 Apr 2016 11:15:51 +0200 Subject: [PATCH] fix(cli): adds better help text. The zip lib is throwing panics sometimes when the response is malformed. The cli will now try to download the zip file up to three times before aborting. The cli gives a better error message and informes the user about retrying. closes #4651 --- pkg/cmd/grafana-cli/commands/install_command.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go index addcf9a8b7e..1ed3a8a3fe8 100644 --- a/pkg/cmd/grafana-cli/commands/install_command.go +++ b/pkg/cmd/grafana-cli/commands/install_command.go @@ -127,9 +127,14 @@ func downloadFile(pluginName, filePath, url string) (err error) { if r := recover(); r != nil { retryCount++ if retryCount < 3 { - fmt.Printf("\nFailed downloading. Will retry once.\n%v\n", r) + + fmt.Println("Failed downloading. Will retry once.") downloadFile(pluginName, filePath, url) } else { + failure := fmt.Sprintf("%v", r) + if failure == "runtime error: makeslice: len out of range" { + log.Errorf("Failed to extract zipped HTTP response. Please try again.\n") + } panic(r) } }