Skip to content

Commit

Permalink
feat(common): add errors to be used in validation throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Oct 2, 2020
1 parent 410ed52 commit 667dbca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions common/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package common

import "errors"

// Common errors
var (
ErrInvalidUrl = errors.New("url is invalid")
ErrInvalidUrlLen = errors.New("url is too short or too long, should be 7-2048 chars")
ErrBlacklistedUrl = errors.New("url matches blacklist pattern")
ErrKeywordsCount = errors.New("url must not have more than 10 keywords")
ErrKeywordLength = errors.New("keyword must contain 2-25 characters")
ErrInvalidDate = errors.New("expires_on should be in 'yyyy-mm-dd hh:mm:ss' format")
ErrPastExpiration = errors.New("expires_on can not be date in past")
ErrUrlAlreadyShort = errors.New("the url is already shortened")
)

0 comments on commit 667dbca

Please sign in to comment.