Skip to content

Commit

Permalink
Add 404 resource error handling in sdkFind
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com>
  • Loading branch information
embano1 committed Mar 2, 2023
1 parent 9fbf8c4 commit 76a8f6d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions templates/pkg/resource/sdk_find_read_one.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func (rm *resourceManager) sdkFind(
{{- end }}
rm.metrics.RecordAPICall("READ_ONE", "{{ .CRD.Ops.ReadOne.ExportedName }}", err)
if err != nil {
if reqErr, ok := ackerr.AWSRequestFailure(err); ok && reqErr.StatusCode() == 404 {
return nil, ackerr.NotFound
+ }
if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "{{ ResourceExceptionCode .CRD 404 }}" {{ GoCodeSetExceptionMessageCheck .CRD 404 }}{
return nil, ackerr.NotFound
}
Expand Down

0 comments on commit 76a8f6d

Please sign in to comment.