-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
50 lines (42 loc) · 2.08 KB
/
Copy patherrors.go
File metadata and controls
50 lines (42 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package bankingcircle
import "github.com/iamkanishka/bankingcircle-go/internal/apierrors"
// Error, ErrorKind, and friends are type aliases onto the internal
// apierrors package so that every bounded-context service package
// (payments, accounts, fx, ...) can construct and return them without
// creating an import cycle back to this root package, while callers of
// this SDK only ever see and depend on bankingcircle.Error.
type (
// Error is the canonical error representation for every failure mode
// this client can surface: transport failures, HTTP 4xx/5xx responses
// (in either of Banking Circle's two documented error body shapes),
// auth failures, and client-side validation errors raised before a
// request is ever sent.
Error = apierrors.Error
// ErrorKind classifies the failure mode of an *Error.
ErrorKind = apierrors.ErrorKind
// ErrorDetail is one normalized entry from either of Banking Circle's
// two documented error body shapes.
ErrorDetail = apierrors.ErrorDetail
// ValidationError represents a client-side validation failure raised
// before any network call is made.
ValidationError = apierrors.ValidationError
// MissingFieldError is returned when a dynamically-required field
// (e.g. either Tenor or QuoteID on FX.Trade) is absent.
MissingFieldError = apierrors.MissingFieldError
)
// Error kind constants — see ErrorKind.
const (
KindTransport = apierrors.KindTransport
KindTimeout = apierrors.KindTimeout
KindAuth = apierrors.KindAuth
KindValidation = apierrors.KindValidation
KindRateLimited = apierrors.KindRateLimited
KindConcurrencyConflict = apierrors.KindConcurrencyConflict
KindNotFound = apierrors.KindNotFound
KindClientError = apierrors.KindClientError
KindServerError = apierrors.KindServerError
KindUnexpectedResponse = apierrors.KindUnexpectedResponse
)
// AsError is a convenience for errors.As(err, &bcErr); it unwraps err to
// find a *bankingcircle.Error, if any is present in its chain.
func AsError(err error) (*Error, bool) { return apierrors.AsError(err) }