aboutsummaryrefslogtreecommitdiff
path: root/errors
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-10-05 15:29:50 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-10-05 15:29:50 +0530
commitb643f7852f93f73843aa5f52f9b4545321713e10 (patch)
tree09938550f85f699fd665127888c4c668f0f1b2a9 /errors
parentd8c1d5fedfac65a79490120195e273b5d5fc75e9 (diff)
added invoice route (barebones)v0.0.11
Diffstat (limited to 'errors')
-rw-r--r--errors/errors.go15
-rw-r--r--errors/status.go1
2 files changed, 9 insertions, 7 deletions
diff --git a/errors/errors.go b/errors/errors.go
index 9a5a215..9fed3a3 100644
--- a/errors/errors.go
+++ b/errors/errors.go
@@ -54,13 +54,14 @@ var (
ErrBrandNotFound = errors.New("This Brand Does Not Exist")
// 409
- ErrNonUniqueGSTIN = errors.New("GSTIN Must Be Unique")
- ErrNonUniquePhone = errors.New("Phone Number Is Already In Use")
- ErrNonUniqueEmail = errors.New("Email Address Is Already In Use")
- ErrNonUniqueUsername = errors.New("Username Is Already In Use")
- ErrNonUniqueWebsite = errors.New("Website Is Already In Use")
- ErrNonUniqueBrandName = errors.New("Brand Name Is Already In Use")
- ErrNonUniqueBrandItem = errors.New("Item With Same Name And Brand Already Exists")
+ ErrNonUniqueGSTIN = errors.New("GSTIN Must Be Unique")
+ ErrNonUniquePhone = errors.New("Phone Number Is Already In Use")
+ ErrNonUniqueEmail = errors.New("Email Address Is Already In Use")
+ ErrNonUniqueUsername = errors.New("Username Is Already In Use")
+ ErrNonUniqueWebsite = errors.New("Website Is Already In Use")
+ ErrNonUniqueBrandName = errors.New("Brand Name Is Already In Use")
+ ErrNonUniqueBrandItem = errors.New("Item With Same Name And Brand Already Exists")
+ ErrNonUniqueInvoiceNumber = errors.New("Invoice Number Must Be Unique")
// 500
ErrInternalServerError = errors.New("Internal Server Error")
diff --git a/errors/status.go b/errors/status.go
index c7fc2a4..c9113a9 100644
--- a/errors/status.go
+++ b/errors/status.go
@@ -71,6 +71,7 @@ func StatusCodeFromErr(err error) int {
errors.Is(err, ErrNonUniqueEmail) ||
errors.Is(err, ErrNonUniqueWebsite) ||
errors.Is(err, ErrNonUniqueBrandName) ||
+ errors.Is(err, ErrNonUniqueInvoiceNumber) ||
errors.Is(err, ErrNonUniqueBrandItem) {
return http.StatusConflict
}