Skip to content

Commit

Permalink
[rekognition] Add helper method for InvalidParameterException error (#27
Browse files Browse the repository at this point in the history
)
  • Loading branch information
evalphobia authored Mar 1, 2018
1 parent 96f9bcc commit 5efab2c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rekognition/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package rekognition

import "strings"

var msgInvalidImageEncoding = `InvalidImageFormatException: Invalid image encoding`
const (
msgInvalidImageEncoding = `InvalidImageFormatException: Invalid image encoding`
msgInvalidParameter = `InvalidParameterException: Request has Invalid Parameters`
)

// IsErrorInvalidImageEncoding checks if gicen error is `Invalid image encoding`.
func IsErrorInvalidImageEncoding(err error) (ok bool) {
Expand All @@ -12,3 +15,12 @@ func IsErrorInvalidImageEncoding(err error) (ok bool) {

return strings.Contains(err.Error(), msgInvalidImageEncoding)
}

// IsErrorInvalidParameter checks if gicen error is `Invalid image encoding`.
func IsErrorInvalidParameter(err error) (ok bool) {
if err == nil {
return false
}

return strings.Contains(err.Error(), msgInvalidImageEncoding)
}

0 comments on commit 5efab2c

Please sign in to comment.