Commit 0855f514 by bergquist

feat(cli): improves defer error handling

parent 70acfb2c
...@@ -127,15 +127,15 @@ func downloadFile(pluginName, filePath, url string) (err error) { ...@@ -127,15 +127,15 @@ func downloadFile(pluginName, filePath, url string) (err error) {
if r := recover(); r != nil { if r := recover(); r != nil {
retryCount++ retryCount++
if retryCount < 3 { if retryCount < 3 {
fmt.Println("Failed downloading. Will retry once.") fmt.Println("Failed downloading. Will retry once.")
downloadFile(pluginName, filePath, url) err = downloadFile(pluginName, filePath, url)
} else { } else {
failure := fmt.Sprintf("%v", r) failure := fmt.Sprintf("%v", r)
if failure == "runtime error: makeslice: len out of range" { if failure == "runtime error: makeslice: len out of range" {
log.Errorf("Failed to extract zipped HTTP response. Please try again.\n") err = fmt.Errorf("Failed to extract zipped HTTP response. Please try again.\n")
} else {
panic(r)
} }
panic(r)
} }
} }
}() }()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment