Documentation
¶
Index ¶
- Constants
- type HttpError
- func (herr HttpError) Append(new_err error) HttpError
- func (herr HttpError) AppendStr(new_err_str string) HttpError
- func (herr HttpError) CompareWith(http_error HttpError) error
- func (herr HttpError) Error() string
- func (herr HttpError) WithFuncName(func_name string) HttpError
- func (herr HttpError) Write(w http.ResponseWriter)
- type HttpErrorType
Constants ¶
View Source
const ( // Errors messages BAD_ERROR string = "error text doesn't match. Won't `%s`, but got `%s`" BAD_CODE string = "error code don't match. Won't `%d`, but got `%d`" BAD_TYPE string = "error type don't match. Won't `%v`, but got `%v`" INTERNAL HttpErrorType = iota EXTERNAL )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpError ¶
type HttpError struct {
Type HttpErrorType
StatusCode int
// contains filtered or unexported fields
}
func NewExternalHttpError ¶
func NewInternalHttpError ¶
func (HttpError) Append ¶
Add new info to error description. For example:
error "internal error" + error "fatal error" = error "internal error;\nfatal error"
func (HttpError) AppendStr ¶ added in v1.0.2
Add new info to error description. For example:
error "internal error" + error "fatal error" = error "internal error;\nfatal error"
func (HttpError) CompareWith ¶
Return nil, if errors not different
func (HttpError) WithFuncName ¶
Change func name, which will be logged
func (HttpError) Write ¶
func (herr HttpError) Write(w http.ResponseWriter)
type HttpErrorType ¶
type HttpErrorType int
Click to show internal directories.
Click to hide internal directories.