Documentation
¶
Index ¶
- Variables
- type CustomError
- func (c CustomError) Error() string
- func (c CustomError) ErrorCode() ErrorCode
- func (c CustomError) ErrorMessage() string
- func (c CustomError) ErrorString() string
- func (c CustomError) Exists() bool
- func (c CustomError) Log()
- func (c CustomError) LoggingParams() map[string]interface{}
- func (c CustomError) ToError() error
- func (c CustomError) ToString() string
- func (c CustomError) UserMessage() string
- func (c CustomError) WithParam(key string, val interface{}) CustomError
- type ErrorCode
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorCodeToUserMessages = map[ErrorCode]string{
REQUEST_NOT_VALID: "Invalid Request. Please try again.",
SQL_INSERT_ERROR: "Something went wrong. Please try again.",
SQL_UPDATE_ERROR: "Something went wrong. Please try again.",
SQL_FETCH_ERROR: "Something went wrong. Please try again.",
}
Functions ¶
This section is empty.
Types ¶
type CustomError ¶
type CustomError struct {
// contains filtered or unexported fields
}
func NewCustomError ¶
func NewCustomError(errorCode ErrorCode, error string) CustomError
func (CustomError) Error ¶
func (c CustomError) Error() string
func (CustomError) ErrorCode ¶
func (c CustomError) ErrorCode() ErrorCode
func (CustomError) ErrorMessage ¶
func (c CustomError) ErrorMessage() string
func (CustomError) ErrorString ¶
func (c CustomError) ErrorString() string
func (CustomError) Exists ¶
func (c CustomError) Exists() bool
func (CustomError) Log ¶
func (c CustomError) Log()
func (CustomError) LoggingParams ¶
func (c CustomError) LoggingParams() map[string]interface{}
func (CustomError) ToError ¶
func (c CustomError) ToError() error
func (CustomError) ToString ¶
func (c CustomError) ToString() string
func (CustomError) UserMessage ¶
func (c CustomError) UserMessage() string
func (CustomError) WithParam ¶
func (c CustomError) WithParam(key string, val interface{}) CustomError
value param should not be a pointer
type ErrorCode ¶
type ErrorCode string
const ( REQUEST_NOT_VALID ErrorCode = "REQUEST_NOT_VALID" SQL_INSERT_ERROR ErrorCode = "SQL_INSERT_ERROR" SQL_UPDATE_ERROR ErrorCode = "SQL_UPDATE_ERROR" SQL_FETCH_ERROR ErrorCode = "SQL_FETCH_ERROR" API_URL_PARSING_ERROR ErrorCode = "API_URL_PARSING_ERROR" API_REQUEST_CREATION_ERROR ErrorCode = "API_REQUEST_CREATION_ERROR" API_REQUEST_ERROR ErrorCode = "API_REQUEST_ERROR" API_REQUEST_STATUS_ERROR ErrorCode = "API_REQUEST_STATUS_ERROR" JSON_SERIALIZATION_ERROR ErrorCode = "JSON_SERIALIZATION_ERROR" JSON_DESERIALIZATION_ERROR ErrorCode = "JSON_DESERIALIZATION_ERROR" FORM_SERIALIZATION_ERROR ErrorCode = "FORM_SERIALIZATION_ERROR" )
Click to show internal directories.
Click to hide internal directories.