worker: rename HasDependencyError() -> IsDependencyError()

Rename the `HasDependencyError()` method to `IsDependencyError()` to
better express what it does.
This commit is contained in:
Tomas Hozza 2022-05-23 15:51:04 +02:00 committed by Tom Gundersen
parent cc1ff1ee1b
commit d9e4889866
3 changed files with 5 additions and 4 deletions

View file

@ -515,7 +515,7 @@ func (h *apiHandlers) GetComposeStatus(ctx echo.Context, id string) error {
return HTTPError(ErrorMalformedOSBuildJobResult)
}
if result.JobError != nil && result.JobError.HasDependencyError() {
if result.JobError != nil && result.JobError.IsDependencyError() {
err = h.server.workers.CheckBuildDependencies(deps[0], result.JobError)
if err != nil {
return HTTPError(ErrorGettingBuildDependencyStatus)
@ -606,7 +606,7 @@ func (h *apiHandlers) GetComposeStatus(ctx echo.Context, id string) error {
if err != nil {
return HTTPError(ErrorMalformedOSBuildJobResult)
}
if buildJobResult.JobError != nil && buildJobResult.JobError.HasDependencyError() {
if buildJobResult.JobError != nil && buildJobResult.JobError.IsDependencyError() {
err = h.server.workers.CheckBuildDependencies(buildDeps[1], buildJobResult.JobError)
if err != nil {
return HTTPError(ErrorGettingBuildDependencyStatus)

View file

@ -83,7 +83,8 @@ func GetStatusCode(err *Error) StatusCode {
}
}
func (e *Error) HasDependencyError() bool {
// IsDependencyError returns true if the error means that a dependency of a job failed
func (e *Error) IsDependencyError() bool {
switch e.ID {
case ErrorDepsolveDependency:
return true

View file

@ -154,7 +154,7 @@ func (s *Server) CheckBuildDependencies(dep uuid.UUID, jobErr *clienterrors.Erro
}
if manifestJobErr := manifestJR.JobError; manifestJobErr != nil {
if !manifestJobErr.HasDependencyError() {
if !manifestJobErr.IsDependencyError() {
jobErr.Details = manifestJobErr
return nil
}