aboutsummaryrefslogtreecommitdiff
path: root/errors
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-09-09 10:20:31 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-09-09 10:20:31 +0530
commit8f2180401fd05ba63633d9559dc156f5ca1573ba (patch)
treef3d2f59b04d5940bc5028904d6ce9d551aace86a /errors
parentcba9f19ba50c60576a5961e89c24caefca52d740 (diff)
logging in with either username or emailv0.0.6
Diffstat (limited to 'errors')
-rw-r--r--errors/errors.go1
-rw-r--r--errors/status.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/errors/errors.go b/errors/errors.go
index 3f1efc5..b5f4f63 100644
--- a/errors/errors.go
+++ b/errors/errors.go
@@ -38,6 +38,7 @@ var (
ErrInvalidGSTPercentage = errors.New("Invalid GST Percentage")
ErrPasswordTooShort = errors.New("Password Is Too Short")
ErrPasswordTooLong = errors.New("Password Is Too Long")
+ ErrInvalidLoginMethod = errors.New("Login Method Can Only Be 'email' Or 'username'")
// 401
ErrWrongPassword = errors.New("Wrong Password")
diff --git a/errors/status.go b/errors/status.go
index 7a23ddf..c7fc2a4 100644
--- a/errors/status.go
+++ b/errors/status.go
@@ -40,6 +40,7 @@ func StatusCodeFromErr(err error) int {
errors.Is(err, ErrInvalidUnitPrice) ||
errors.Is(err, ErrPasswordTooShort) ||
errors.Is(err, ErrPasswordTooLong) ||
+ errors.Is(err, ErrInvalidLoginMethod) ||
errors.Is(err, ErrInvalidGSTPercentage) {
return http.StatusBadRequest
}