fix(downloader): improve error reporting by returning nil for no error
parent
02609e6e1e
commit
a1a11d482b
|
@ -108,7 +108,12 @@ func downloadStatusHandler(downloaderCache *cache.Cache) handleFunc {
|
|||
"url": taskCache.URL,
|
||||
"taskID": taskCache.TaskID.String(),
|
||||
"status": taskCache.status,
|
||||
"error": fmt.Sprint(taskCache.err),
|
||||
"error": func() interface{} {
|
||||
if taskCache.err == nil {
|
||||
return nil
|
||||
}
|
||||
return taskCache.err.Error()
|
||||
}(),
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
err := json.NewEncoder(w).Encode(&responseBody)
|
||||
|
|
Loading…
Reference in New Issue