forked from genert/pipedrive-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.go
32 lines (27 loc) · 734 Bytes
/
errors.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
package pipedrive
import (
"fmt"
"net/http"
)
// RateLimitError occurs when Pipedrive returns 403 Forbidden response with a rate limit
// remaining value of 0.
type RateLimitError struct {
Rate Rate
Response *http.Response
Message string
}
func (e *RateLimitError) Error() string {
return fmt.Sprintf("%v %v: %d %v",
e.Response.Request.Method, e.Response.Request.URL,
e.Response.StatusCode, e.Message)
}
// ErrorResponse reports one or more errors caused by an API request.
type ErrorResponse struct {
Response *http.Response
Message string
}
func (e *ErrorResponse) Error() string {
return fmt.Sprintf("%v %v: %d %v",
e.Response.Request.Method, e.Response.Request.URL,
e.Response.StatusCode, e.Message)
}