-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): add errors to be used in validation throughout
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
) |