mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 01:04:25 +08:00
add comments
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// General error codes
|
||||
var (
|
||||
ErrIncompleteOrIncorrectSubmission = NewNormalError(NORMAL_SUBCATEGORY_GLOBAL, 0, http.StatusBadRequest, "incomplete or incorrect submission")
|
||||
ErrOperationFailed = NewNormalError(NORMAL_SUBCATEGORY_GLOBAL, 1, http.StatusInternalServerError, "operation failed")
|
||||
@@ -16,50 +17,62 @@ var (
|
||||
ErrPageCountInvalid = NewNormalError(NORMAL_SUBCATEGORY_GLOBAL, 7, http.StatusBadRequest, "page count is invalid")
|
||||
)
|
||||
|
||||
// GetParameterInvalidMessage returns specific error message for invalid parameter error
|
||||
func GetParameterInvalidMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" is invalid", field)
|
||||
}
|
||||
|
||||
// GetParameterIsRequiredMessage returns specific error message for missing parameter error
|
||||
func GetParameterIsRequiredMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" is required", field)
|
||||
}
|
||||
|
||||
// GetParameterMustLessThanMessage returns specific error message for parameter too large error
|
||||
func GetParameterMustLessThanMessage(field string, param string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" must be less than %s", field, param)
|
||||
}
|
||||
|
||||
// GetParameterMustLessThanCharsMessage returns specific error message for parameter too long error
|
||||
func GetParameterMustLessThanCharsMessage(field string, param string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" must be less than %s characters", field, param)
|
||||
}
|
||||
|
||||
// GetParameterMustMoreThanMessage returns specific error message for parameter too small error
|
||||
func GetParameterMustMoreThanMessage(field string, param string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" must be more than %s", field, param)
|
||||
}
|
||||
|
||||
// GetParameterMustMoreThanCharsMessage returns specific error message for parameter too short error
|
||||
func GetParameterMustMoreThanCharsMessage(field string, param string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" must be more than %s characters", field, param)
|
||||
}
|
||||
|
||||
// GetParameterLengthNotEqualMessage returns specific error message for parameter length wrong error
|
||||
func GetParameterLengthNotEqualMessage(field string, param string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" length is not equal to %s", field, param)
|
||||
}
|
||||
|
||||
// GetParameterNotBeBlankMessage returns specific error message for blank parameter error
|
||||
func GetParameterNotBeBlankMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" cannot be blank", field)
|
||||
}
|
||||
|
||||
// GetParameterInvalidUsernameMessage returns specific error message for invalid username parameter error
|
||||
func GetParameterInvalidUsernameMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" is invalid username format", field)
|
||||
}
|
||||
|
||||
// GetParameterInvalidEmailMessage returns specific error message for invalid email parameter error
|
||||
func GetParameterInvalidEmailMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" is invalid email format", field)
|
||||
}
|
||||
|
||||
// GetParameterInvalidCurrencyMessage returns specific error message for invalid currency parameter error
|
||||
func GetParameterInvalidCurrencyMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" is invalid currency", field)
|
||||
}
|
||||
|
||||
// GetParameterInvalidHexRGBColorMessage returns specific error message for invalid hex rgb color parameter error
|
||||
func GetParameterInvalidHexRGBColorMessage(field string) string {
|
||||
return fmt.Sprintf("parameter \"%s\" is invalid color", field)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user