Skip to content

Commit

Permalink
OCM-3963 | feat: Additional error
Browse files Browse the repository at this point in the history
  • Loading branch information
den-rgb committed Nov 28, 2023
1 parent 3548272 commit 8a5afc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/aws/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ func IsInvalidTokenException(err error) bool {
return IsErrorCode(err, InvalidClientTokenID)
}

func IsDeleteConfictException(err error) bool {
var deleteConflict *iamtypes.DeleteConflictException
return errors.As(err, &deleteConflict)
}

6 changes: 6 additions & 0 deletions pkg/aws/errors/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,10 @@ var _ = Describe("Error Checks", func() {
Expect(IsErrorCode(err, "DifferentCode")).To(BeFalse())
})

It("should identify IsDeleteConfictException", func() {
err := &iamtypes.DeleteConflictException{}
Expect(IsDeleteConfictException(err)).To(BeTrue())
Expect(IsDeleteConfictException(errors.New("random error"))).To(BeFalse())
})

})

0 comments on commit 8a5afc0

Please sign in to comment.