-
Notifications
You must be signed in to change notification settings - Fork 929
/
errors.go
106 lines (83 loc) · 2.46 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package uaa
import "fmt"
// RawHTTPStatusError represents any response with a 4xx or 5xx status code.
type RawHTTPStatusError struct {
StatusCode int
RawResponse []byte
}
func (r RawHTTPStatusError) Error() string {
return fmt.Sprintf("Error Code: %d\nRaw Response: %s", r.StatusCode, r.RawResponse)
}
// UAAErrorResponse represents a generic UAA error response.
type UAAErrorResponse struct {
Type string `json:"error"`
Description string `json:"error_description"`
}
func (e UAAErrorResponse) Error() string {
return fmt.Sprintf("Error Type: %s\nDescription: %s", e.Type, e.Description)
}
// ConflictError is returned when the response status code is 409. It
// represents when there is a conflict in the state of the requested resource.
type ConflictError struct {
Message string
}
func (e ConflictError) Error() string {
return e.Message
}
// UnverifiedServerError replaces x509.UnknownAuthorityError when the server
// has SSL but the client is unable to verify it's certificate
type UnverifiedServerError struct {
URL string
}
func (e UnverifiedServerError) Error() string {
return "x509: certificate signed by unknown authority"
}
// RequestError represents a generic error encountered while performing the
// HTTP request. This generic error occurs before a HTTP response is obtained.
type RequestError struct {
Err error
}
func (e RequestError) Error() string {
return e.Err.Error()
}
// UnauthorizedError is returned when the authentication informatin is invalid.
type UnauthorizedError struct {
Message string
}
func (e UnauthorizedError) Error() string {
return e.Message
}
// InvalidAuthTokenError is returned when the client has an invalid
// authorization header.
type InvalidAuthTokenError struct {
Message string
}
func (e InvalidAuthTokenError) Error() string {
return e.Message
}
// InsufficientScopeError is returned when the client has insufficient scope
type InsufficientScopeError struct {
Message string
}
func (e InsufficientScopeError) Error() string {
return e.Message
}
// InvalidSCIMResourceError is returned usually when the client tries to create an inproperly formatted username
type InvalidSCIMResourceError struct {
Message string
}
func (e InvalidSCIMResourceError) Error() string {
return e.Message
}
type AccountLockedError struct {
Message string
}
func (e AccountLockedError) Error() string {
return ""
}
type InvalidPasswordError struct {
Message string
}
func (e InvalidPasswordError) Error() string {
return e.Message
}