Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code int
Code is custom error code
const ( ErrCodeUnknown Code ErrCodeNotFound ErrCodeInsufficientBalance )
error codes
const ( ErrCodeDuplicateEmail Code ErrCodeDuplicateAddress ErrCodeDuplicateAuthToken )
duplicate error
const (
ErrCodeMandrill Code
)
external service error
type Error ¶
Error is custom error
Example ¶
e := New(ErrCodeDuplicateEmail) e.ErrStringForLogging = "for logging purpose" fmt.Println(e) raw, _ := json.Marshal(e) fmt.Println(string(raw))
Output: 5001 {"code":5001}
func (*Error) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
Click to show internal directories.
Click to hide internal directories.