Skip to content
Csaba Okrona edited this page Oct 5, 2020 · 1 revision

The library provides its own APIError error type - see errors.go

type APIError struct {
	ErrorCode    int `json:"error_code"`
	StatusCode   int
	Message      string
	WrappedError error
}
  • ErrorCode - There are error codes defined by the API itself, see the API docs - these have been mapped to their respective constants, e.g. ErrRateLimitExceeded. There are also custom error constants for different error scenarios, such as ErrNotAuthenticated. The list of constants is in errors.go
  • StatusCode - Whenever possible the HTTP status code from the API call response is saved here
  • Message - The error message either coming from the API response or proxied from the underlying caught error
  • WrappedError - When there was an underlying error, e.g. during JSON decoding, or a HTTP layer error it's captured here