Skip to content

Commit

Permalink
Add New method to TerminalError (#82)
Browse files Browse the repository at this point in the history
This method helps to throw terminal error from the controller.

Controller code can throw errors like

```
	if *latestStatus == "create-failed" {
		return nil, ackerr.TerminalError.New(errors.New("cluster cannot be updated as its status is not 'available'."))
	}
```

Code generator changes - aws-controllers-k8s/code-generator#318

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
nmvk committed Apr 5, 2022
1 parent 89fb5ef commit a1b0863
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ type TerminalError struct {
err error
}

func (e TerminalError) New(terminalError error) *TerminalError {
return &TerminalError{err: terminalError}
}

func (e TerminalError) Error() string {
if e.err == nil {
return ""
Expand Down

0 comments on commit a1b0863

Please sign in to comment.