feat(aria2): show detailed error message from aria2 (#2296)
This commit is contained in:
2
assets
2
assets
Submodule assets updated: 587e9f29cf...5e8e63b378
@@ -139,6 +139,7 @@ func (a *aria2Client) Info(ctx context.Context, handle *downloader.TaskHandle) (
|
|||||||
UploadSpeed: uploadSpeed,
|
UploadSpeed: uploadSpeed,
|
||||||
SavePath: savePath,
|
SavePath: savePath,
|
||||||
NumPieces: numPieces,
|
NumPieces: numPieces,
|
||||||
|
ErrorMessage: status.ErrorMessage,
|
||||||
Hash: status.InfoHash,
|
Hash: status.InfoHash,
|
||||||
Files: lo.Map(status.Files, func(item rpc.FileInfo, index int) downloader.TaskFile {
|
Files: lo.Map(status.Files, func(item rpc.FileInfo, index int) downloader.TaskFile {
|
||||||
index, _ = strconv.Atoi(item.Index)
|
index, _ = strconv.Atoi(item.Index)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ type (
|
|||||||
Files []TaskFile `json:"files,omitempty"`
|
Files []TaskFile `json:"files,omitempty"`
|
||||||
Pieces []byte `json:"pieces,omitempty"` // Hexadecimal representation of the download progress of the peer. The highest bit corresponds to the piece at index 0.
|
Pieces []byte `json:"pieces,omitempty"` // Hexadecimal representation of the download progress of the peer. The highest bit corresponds to the piece at index 0.
|
||||||
NumPieces int `json:"num_pieces,omitempty"`
|
NumPieces int `json:"num_pieces,omitempty"`
|
||||||
|
ErrorMessage string `json:"error_message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskFile struct {
|
TaskFile struct {
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ func (m *RemoteDownloadTask) monitor(ctx context.Context, dep dependency.Dep) (t
|
|||||||
m.ResumeAfter(resumeAfter)
|
m.ResumeAfter(resumeAfter)
|
||||||
return task.StatusSuspending, nil
|
return task.StatusSuspending, nil
|
||||||
case downloader.StatusUnknown, downloader.StatusError:
|
case downloader.StatusUnknown, downloader.StatusError:
|
||||||
return task.StatusError, fmt.Errorf("download task failed with state %q (%w)", status.State, queue.CriticalErr)
|
return task.StatusError, fmt.Errorf("download task failed with state %q (%w), errorMsg: %s", status.State, queue.CriticalErr, status.ErrorMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.ResumeAfter(resumeAfter)
|
m.ResumeAfter(resumeAfter)
|
||||||
|
|||||||
Reference in New Issue
Block a user