Documentation ¶
Index ¶
- type HTTPError
- func BadRequest() *HTTPError
- func BridgeNotFound() *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 TooManyBridges() *HTTPError
- func TooManyBridgesForClient() *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 { Status int `json:"-"` Code string `json:"code"` Reason string `json:"reason"` }
HTTPError is a custom error type that implements the error interface.
func BridgeNotFound ¶ added in v1.1.0
func BridgeNotFound() *HTTPError
BridgeNotFound is returned when the required bridge does not exist.
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 TooManyBridges ¶ added in v1.0.0
func TooManyBridges() *HTTPError
TooManyBridges is returned when there's a new bridge creation attempt but the node has reached its bridge limit.
func TooManyBridgesForClient ¶ added in v1.0.0
func TooManyBridgesForClient() *HTTPError
TooManyBridgesForClient is returned when there's a new bridge creation attempt by a client but the node has reached its bridge limit for that client.
func Unauthorized ¶
func Unauthorized() *HTTPError
Unauthorized is for requests with invalid credentials.
func (*HTTPError) Error ¶
Error provides the reason behind the error, which is usually human-readable. If the reason is absent, it provides the error code instead.
func (*HTTPError) WithReasonError ¶ added in v1.0.0
WithReasonError is a chainable method to set the reason of the HTTPError.
This accepts the reason as an error.
func (*HTTPError) WithReasonString ¶ added in v1.0.0
WithReasonString is a chainable method to set the reason of the HTTPError.
This accepts the reason as a string.