Skip to content

Commit a1b0863

Browse files
authored
Add New method to TerminalError (#82)
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.
1 parent 89fb5ef commit a1b0863

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/errors/error.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ type TerminalError struct {
9292
err error
9393
}
9494

95+
func (e TerminalError) New(terminalError error) *TerminalError {
96+
return &TerminalError{err: terminalError}
97+
}
98+
9599
func (e TerminalError) Error() string {
96100
if e.err == nil {
97101
return ""

0 commit comments

Comments
 (0)