-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
21 lines (17 loc) · 880 Bytes
/
errors.go
File metadata and controls
21 lines (17 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main
import "errors"
type ValidationError error
var (
errNoUsername = ValidationError(errors.New("You must supply a username"))
errNoEmail = ValidationError(errors.New("You must supply an email"))
errNoPassword = ValidationError(errors.New("You must supply a password"))
errPasswordTooShort = ValidationError(errors.New("Your password is too short"))
errUsernameExists = ValidationError(errors.New("That username is taken"))
errEmailExists = ValidationError(errors.New("That email address has an account"))
errCredentialsIncorrect = ValidationError(errors.New("We couldn't find a user with the supplied username and password combination"))
errPasswordIncorrect = ValidationError(errors.New("Password did not match"))
)
func IsValidationError(err error) bool {
_, ok := err.(ValidationError)
return ok
}