diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-09-02 23:12:52 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-09-02 23:12:52 +0530 |
commit | 7f12e4fa01a2bf3ab25844f3d73af67881a587f1 (patch) | |
tree | 635627eecf325d0d78f45d161d8bb110d3cfcc1e /errors | |
parent | 127d4fb8ee7f8b141f9fb2f1a8fda45d350f34fc (diff) |
added sign-in
Diffstat (limited to 'errors')
-rw-r--r-- | errors/errors.go | 3 | ||||
-rw-r--r-- | errors/status.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/errors/errors.go b/errors/errors.go index 08d8a4c..dd307e5 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -33,6 +33,8 @@ var ( ErrEmptyBrandName = errors.New("Brand Name Cannot Be Empty") ErrInvalidUnitPrice = errors.New("Invalid Unit Price") ErrInvalidGSTPercentage = errors.New("Invalid GST Percentage") + ErrPasswordTooShort = errors.New("Password Is Too Short") + ErrPasswordTooLong = errors.New("Password Is Too Long") // 404 ErrNotFound = errors.New("Not Found") @@ -42,6 +44,7 @@ var ( ErrNonUniqueGSTIN = errors.New("GSTIN Must Be Unique") ErrNonUniquePhone = errors.New("Phone Number Must Be Unique") ErrNonUniqueEmail = errors.New("Email Address Must Be Unique") + ErrNonUniqueUsername = errors.New("Email Address Must Be Unique") ErrNonUniqueWebsite = errors.New("Website Must Be Unique") ErrNonUniqueBrandName = errors.New("Brand Name Must Be Unique") ErrNonUniqueBrandItem = errors.New("Item With Same Name And Brand Already Exists") diff --git a/errors/status.go b/errors/status.go index eb59506..b0da1ae 100644 --- a/errors/status.go +++ b/errors/status.go @@ -35,6 +35,8 @@ func StatusCodeFromErr(err error) int { errors.Is(err, ErrInvalidGSTIN) || errors.Is(err, ErrEmptyBrandName) || errors.Is(err, ErrInvalidUnitPrice) || + errors.Is(err, ErrPasswordTooShort) || + errors.Is(err, ErrPasswordTooLong) || errors.Is(err, ErrInvalidGSTPercentage) { return http.StatusBadRequest } @@ -48,6 +50,7 @@ func StatusCodeFromErr(err error) int { // 409 if errors.Is(err, ErrNonUniqueGSTIN) || errors.Is(err, ErrNonUniquePhone) || + errors.Is(err, ErrNonUniqueUsername) || errors.Is(err, ErrNonUniqueEmail) || errors.Is(err, ErrNonUniqueWebsite) || errors.Is(err, ErrNonUniqueBrandName) || |