Documentation
¶
Overview ¶
Package errors provides structured, sentinel-based error types for the SaltEdge Go client. All errors implement the standard error interface and support errors.Is / errors.As unwrapping.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // 4xx ErrBadRequest = &APIError{StatusCode: http.StatusBadRequest} ErrForbidden = &APIError{StatusCode: http.StatusForbidden} ErrNotFound = &APIError{StatusCode: http.StatusNotFound} ErrConflict = &APIError{StatusCode: http.StatusConflict} ErrUnprocessableEntity = &APIError{StatusCode: http.StatusUnprocessableEntity} ErrTooManyRequests = &APIError{StatusCode: http.StatusTooManyRequests} // 5xx ErrInternalServer = &APIError{StatusCode: http.StatusInternalServerError} ErrBadGateway = &APIError{StatusCode: http.StatusBadGateway} // Domain-specific (matched by class) ErrCustomerNotFound = &APIError{StatusCode: 404, Class: "CustomerNotFound"} ErrConnectionNotFound = &APIError{StatusCode: 404, Class: "ConnectionNotFound"} ErrProviderNotFound = &APIError{StatusCode: 404, Class: "ProviderNotFound"} ErrAccountNotFound = &APIError{StatusCode: 404, Class: "AccountNotFound"} ErrConsentNotFound = &APIError{StatusCode: 404, Class: "ConsentNotFound"} ErrPaymentNotFound = &APIError{StatusCode: 404, Class: "PaymentNotFound"} ErrInvalidCredentials = &APIError{StatusCode: 406, Class: "InvalidCredentials"} ErrProviderDisabled = &APIError{StatusCode: 406, Class: "ProviderDisabled"} ErrConnectionDuplicated = &APIError{StatusCode: 409, Class: "ConnectionDuplicated"} ErrWrongRequestFormat = &APIError{StatusCode: 400, Class: "WrongRequestFormat"} )
Functions ¶
func IsNotFound ¶
IsNotFound returns true when err is a 404 APIError.
func IsRateLimit ¶
IsRateLimit returns true when err is a 429 APIError.
func IsRetryable ¶
IsRetryable returns true for transient errors that should be retried.
func IsServerError ¶
IsServerError returns true when err has a 5xx status.
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"status_code"`
Class string `json:"class"`
Message string `json:"message"`
RequestID string `json:"request_id,omitempty"`
Raw []byte `json:"-"`
}
APIError is returned for all non-2xx HTTP responses from the SaltEdge API.
func NewAPIError ¶
NewAPIError constructs an *APIError from a status code and raw response body.
type DecodeError ¶
DecodeError wraps JSON decode failures on API responses.
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
func (*DecodeError) Unwrap ¶
func (e *DecodeError) Unwrap() error
type NetworkError ¶
type NetworkError struct {
Cause error
}
NetworkError wraps transport-level failures (DNS, TLS, connect timeout).
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
func (*NetworkError) Unwrap ¶
func (e *NetworkError) Unwrap() error
type SignatureError ¶
type SignatureError struct {
Reason string
}
SignatureError is raised when request or webhook signature verification fails.
func (*SignatureError) Error ¶
func (e *SignatureError) Error() string
type ValidationError ¶
ValidationError is raised client-side before the request is sent.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string