feat(aria2): show detailed error message from aria2 (#2296)

pull/2358/head
Aaron Liu 2025-04-27 10:36:06 +08:00
parent c6eef43590
commit 77ae381474
4 changed files with 4 additions and 2 deletions

2
assets

@ -1 +1 @@
Subproject commit 587e9f29cf45c650546191a9a0ce7bac6642af2a
Subproject commit 5e8e63b37895172e162d34a97c4991fb2869ceb3

View File

@ -139,6 +139,7 @@ func (a *aria2Client) Info(ctx context.Context, handle *downloader.TaskHandle) (
UploadSpeed: uploadSpeed,
SavePath: savePath,
NumPieces: numPieces,
ErrorMessage: status.ErrorMessage,
Hash: status.InfoHash,
Files: lo.Map(status.Files, func(item rpc.FileInfo, index int) downloader.TaskFile {
index, _ = strconv.Atoi(item.Index)

View File

@ -44,6 +44,7 @@ type (
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.
NumPieces int `json:"num_pieces,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
}
TaskFile struct {

View File

@ -281,7 +281,7 @@ func (m *RemoteDownloadTask) monitor(ctx context.Context, dep dependency.Dep) (t
m.ResumeAfter(resumeAfter)
return task.StatusSuspending, nil
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)