Documentation ¶
Index ¶
Constants ¶
View Source
const ErrorMessagesFilePath = "/Users/hq/go/src/ecommerce/src/errors/error_messages.json"
ErrorMessagesFilePath is path of error_messages.json file.
View Source
const (
ModuleCommon = 00
)
Variables ¶
View Source
var ( InvalidRequestError = fmtErrorCode(http.StatusBadRequest, ModuleCommon, 1) // 400001 PermissionAccessError = fmtErrorCode(http.StatusForbidden, ModuleCommon, 1) ErrorRecordNotFound = fmtErrorCode(http.StatusNotFound, ModuleCommon, 1) // 404001 InternalServerError = fmtErrorCode(http.StatusInternalServerError, ModuleCommon, 1) // 500001 ErrNoResponse = fmtErrorCode(http.StatusInternalServerError, ModuleCommon, 3) // 500003 )
common should be defined in common package used by all services.
Functions ¶
func GetErrorMessage ¶
GetErrorMessage gets error message from errorMessageMap.
func InitErrorMessagesResource ¶
func InitErrorMessagesResource() error
InitErrorMessagesResource loads error messages resource.
Types ¶
type ErrorCode ¶
type ErrorCode struct {
// contains filtered or unexported fields
}
func (ErrorCode) DetailCode ¶
Click to show internal directories.
Click to hide internal directories.