Skip to content

Commit 9373b21

Browse files
authored
Add 404 resource error handling in sdkFind (#421)
Signed-off-by: Michael Gasch <[email protected]>
1 parent c8ed37a commit 9373b21

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

templates/pkg/resource/sdk_find_read_one.go.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ func (rm *resourceManager) sdkFind(
3434
{{- end }}
3535
rm.metrics.RecordAPICall("READ_ONE", "{{ .CRD.Ops.ReadOne.ExportedName }}", err)
3636
if err != nil {
37+
if reqErr, ok := ackerr.AWSRequestFailure(err); ok && reqErr.StatusCode() == 404 {
38+
return nil, ackerr.NotFound
39+
}
3740
if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "{{ ResourceExceptionCode .CRD 404 }}" {{ GoCodeSetExceptionMessageCheck .CRD 404 }}{
3841
return nil, ackerr.NotFound
3942
}

0 commit comments

Comments
 (0)