-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
19 lines (16 loc) · 987 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package product
import (
"errors"
"net/http"
)
var (
ErrorForbidden = Response{Code: http.StatusForbidden, Message: "Forbidden", Error: errors.New("Forbidden")}
ErrorUnauthorized = Response{Code: http.StatusUnauthorized, Message: "Unauthorized", Error: errors.New("Unauthorized")}
ErrorRequiredField = Response{Code: http.StatusBadRequest, Message: "Required field"}
ErrorInternal = Response{Code: http.StatusInternalServerError, Message: "Internal Server Error", Error: errors.New("Internal Server Error")}
ErrorBadRequest = Response{Code: http.StatusBadRequest, Message: "Bad Request"}
ErrorNoRecords = Response{Code: http.StatusOK, Message: "No records found"}
ErrorNotFound = Response{Code: http.StatusNotFound, Message: "No records found"}
ErrorNotPurchasable = Response{Code: http.StatusBadRequest, Message: "product is not purchasable"}
ErrorInsufficientStock = Response{Code: http.StatusBadRequest, Message: "insufficient product stock"}
)