Skip to content

Commit

Permalink
Add IsAlreadyExists error helper
Browse files Browse the repository at this point in the history
Closes: #2675
Signed-off-by: Michael Gasch <mgasch@vmware.com>
  • Loading branch information
Michael Gasch committed Dec 2, 2021
1 parent 13c6303 commit b51418e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vim25/types/fault.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ func IsFileNotFound(err error) bool {

return false
}

func IsAlreadyExists(err error) bool {
if f, ok := err.(HasFault); ok {
switch f.Fault().(type) {
case *AlreadyExists:
return true
}
}

return false
}

0 comments on commit b51418e

Please sign in to comment.