- SyncStoresCategory

- TaskError for json output.
This commit is contained in:
gazebo
2018-10-27 16:12:00 +08:00
parent 970e8dc7b2
commit eac24b9a5a
8 changed files with 163 additions and 26 deletions

View File

@@ -43,6 +43,20 @@ type ITask interface {
json.Marshaler
}
type TaskError struct {
error
}
func (t *TaskError) MarshalJSON() ([]byte, error) {
return json.Marshal(t.Error())
}
func NewTaskError(err error) *TaskError {
return &TaskError{
err,
}
}
type BaseTask struct {
Name string `json:"name"`
ID string `json:"id"`
@@ -61,10 +75,11 @@ type BaseTask struct {
FailedJobCount int `json:"failedJobCount"`
Status int `json:"status"`
Result []interface{} `json:"result"`
Err error `json:"err"`
Children TaskList `json:"children"`
DetailErrList []error `json:"detailErrList"`
Result []interface{} `json:"result"`
Children TaskList `json:"children"`
Err error `json:"err"`
DetailErrList []error `json:"detailErrList"`
finishChan chan int
C <-chan int `json:"-"`