mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-22 14:52:17 +01:00
fix(js):job log not found issue
- return 404 code when the job log is not found Signed-off-by: Steven Zou <szou@vmware.com>
This commit is contained in:
parent
88889ba864
commit
39256193ca
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user