Merge pull request #14629 from steven-zou/fix/job_log_not_found_issue_2.2

fix(js):job log not found issue
This commit is contained in:
Steven Zou 2021-04-13 14:15:21 +08:00 committed by GitHub
commit cf756802b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -133,12 +133,7 @@ func (bc *basicController) GetJobLogData(jobID string) ([]byte, error) {
return nil, errs.BadRequestError(errors.New("empty job ID"))
}
logData, err := logger.Retrieve(jobID)
if err != nil {
return nil, errors.Wrapf(err, "error for getting log of job %s", jobID)
}
return logData, nil
return logger.Retrieve(jobID)
}
// CheckStatus is implementation of same method in core interface.

View File

@ -2,7 +2,10 @@ package getter
import (
"errors"
"fmt"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/jobservice/errs"
)
// DBGetter is responsible for retrieving DB log data
@ -22,7 +25,8 @@ func (dbg *DBGetter) Retrieve(logID string) ([]byte, error) {
jobLog, err := dao.GetJobLog(logID)
if err != nil {
return nil, err
// Other errors have been ignored by GetJobLog()
return nil, errs.NoObjectFoundError(fmt.Sprintf("log entity: %s", logID))
}
return []byte(jobLog.Content), nil