Skip to content

Commit

Permalink
fix: infinite nested errors (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-esk authored May 16, 2024
1 parent 41c8482 commit bf34125
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/builder/docker/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

if e.Err != nil {
return fmt.Sprintf("%s: %v", e.Message, e.Err)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/builder/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

if e.Err != nil {
return fmt.Sprintf("%s: %v", e.Message, e.Err)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/builder/kaniko/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

if e.Err != nil {
return fmt.Sprintf("%s: %v", e.Message, e.Err)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/container/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

msg := fmt.Sprintf(e.Message, e.Params...)
if e.Err != nil {
return fmt.Sprintf("%s: %v", msg, e.Err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/k8s/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

msg := fmt.Sprintf(e.Message, e.Params...)
if e.Err != nil {
return fmt.Sprintf("%s: %v", msg, e.Err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/knuu/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

msg := fmt.Sprintf(e.Message, e.Params...)
if e.Err != nil {
return fmt.Sprintf("%s: %v", msg, e.Err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/minio/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type Error struct {
}

func (e *Error) Error() string {
if e.Err == e {
return e.Message
}

msg := fmt.Sprintf(e.Message, e.Params...)
if e.Err != nil {
return fmt.Sprintf("%s: %v", msg, e.Err)
Expand Down

0 comments on commit bf34125

Please sign in to comment.