-
Notifications
You must be signed in to change notification settings - Fork 23
/
APICallFailure.go
36 lines (30 loc) · 997 Bytes
/
APICallFailure.go
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
package error
// NewAPIClientError creates a new API call error
func NewAPIClientError(apiURL string, httpStatusCode *int, httpResponseBody *string, err error) APIClientError {
return &APIClientErrorImpl{apiURL, httpStatusCode, httpResponseBody, createUnexpectedErrorImpl(ErrorCodeAPICallFailure, err)}
}
// APIClientError represents an database query failure error interface
type APIClientError interface {
UnexpectedError
GetAPIURL() string
GetHTTPStatusCode() *int
GetHTTPResponseBody() *string
}
type APIClientErrorImpl struct {
apiURL string
httpStatusCode *int
httpResponseBody *string
unexpectedErrorImpl
}
// GetAPIURL gets API URL
func (e *APIClientErrorImpl) GetAPIURL() string {
return e.apiURL
}
// GetHttpStatusCode gets http status code
func (e *APIClientErrorImpl) GetHTTPStatusCode() *int {
return e.httpStatusCode
}
// GetHTTPResponseBody gets http status code
func (e *APIClientErrorImpl) GetHTTPResponseBody() *string {
return e.httpResponseBody
}