Documentation ¶
Index ¶
- type HTTPError
- func AccountAlreadyExists() *HTTPError
- func AccountIsInUse() *HTTPError
- func AccountNotFound() *HTTPError
- func BadRequest() *HTTPError
- func Conflict() *HTTPError
- func Forbidden() *HTTPError
- func InternalServerError() *HTTPError
- func NotFound() *HTTPError
- func PaymentRequired() *HTTPError
- func PreconditionFailed() *HTTPError
- func RequestTimeout() *HTTPError
- func ToHTTPError(err interface{}) *HTTPError
- func TransactionNotFound() *HTTPError
- func Unauthorized() *HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPError ¶
type HTTPError struct { StatusCode int `json:"status_code"` CustomCode string `json:"custom_code"` Errors []string `json:"errors"` }
HTTPError is a custom error type that implements the error interface.
func AccountAlreadyExists ¶
func AccountAlreadyExists() *HTTPError
AccountAlreadyExists is for requests that want to duplicate an existing account.
func AccountIsInUse ¶
func AccountIsInUse() *HTTPError
AccountIsInUse is for requests that want to delete an account that is being used by transactions.
func AccountNotFound ¶
func AccountNotFound() *HTTPError
AccountNotFound is for requests that want to access a non-existent account.
func Conflict ¶
func Conflict() *HTTPError
Conflict is for requests that attempt paradoxical operations, such as re-creating the same resource.
func Forbidden ¶
func Forbidden() *HTTPError
Forbidden is for requests that do not have enough authority to execute the operation.
func InternalServerError ¶
func InternalServerError() *HTTPError
InternalServerError is for requests that cause an unexpected misbehaviour.
func NotFound ¶
func NotFound() *HTTPError
NotFound is for requests that try to access a non-existent resource.
func PaymentRequired ¶
func PaymentRequired() *HTTPError
PaymentRequired is for requests that require payment completion.
func PreconditionFailed ¶
func PreconditionFailed() *HTTPError
PreconditionFailed is for requests that do not satisfy pre-business layers of the application.
func RequestTimeout ¶
func RequestTimeout() *HTTPError
RequestTimeout is for requests that take longer than a certain time limit to execute.
func ToHTTPError ¶
func ToHTTPError(err interface{}) *HTTPError
ToHTTPError converts any value to an appropriate HTTPError.
func TransactionNotFound ¶
func TransactionNotFound() *HTTPError
TransactionNotFound is for requests that want to access a non-existent transaction.
func Unauthorized ¶
func Unauthorized() *HTTPError
Unauthorized is for requests with invalid credentials.
func (*HTTPError) AddErrors ¶
AddErrors is a chainable method to add error messages to the HTTPError.
func (*HTTPError) AddMessages ¶
AddMessages is a chainable method to add string messages to the HTTPError.