-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patherrormessages.go
More file actions
63 lines (54 loc) · 1.75 KB
/
errormessages.go
File metadata and controls
63 lines (54 loc) · 1.75 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
51
52
53
54
55
56
57
58
59
60
61
62
63
package keycloak
import (
"fmt"
)
// Constants for error management
const (
MsgErrMissingParam = "missingParameter"
MsgErrInvalidParam = "invalidParameter"
MsgErrCannotObtain = "cannotObtain"
MsgErrCannotMarshal = "cannotMarshal"
MsgErrCannotUnmarshal = "cannotUnmarshal"
MsgErrCannotParse = "cannotParse"
MsgErrCannotCreate = "cannotCreate"
MsgErrUnkownHTTPContentType = "unkownHTTPContentType"
MsgErrUnknownResponseStatusCode = "unknownResponseStatusCode"
MsgErrExistingValue = "existing"
MsgErrReadOnly = "readOnlyValue"
MsgErrCannotGetIssuer = "cannotGetIssuer"
EvenParams = "key/valParametersShouldBeEven"
TokenProviderURL = "tokenProviderURL"
APIURL = "APIURL"
TokenMsg = "token"
Response = "response"
AccessToken = "accessToken"
OIDCProvider = "OIDCProvider"
UserOrEmail = "UsernameOrEmail"
Username = "username"
Email = "email"
)
// HTTPError is returned when an error occured while contacting the keycloak instance.
type HTTPError struct {
HTTPStatus int
Message string
}
func (e HTTPError) Error() string {
return fmt.Sprintf("%d:%s", e.HTTPStatus, e.Message)
}
// ClientDetailedError struct
type ClientDetailedError struct {
HTTPStatus int
Message string
}
// Error implements error
func (e ClientDetailedError) Error() string {
return fmt.Sprintf("%d:%s", e.HTTPStatus, e.Message)
}
// Status implements common-service/errors/DetailedError
func (e ClientDetailedError) Status() int {
return e.HTTPStatus
}
// ErrorMessage implements common-service/errors/DetailedError
func (e ClientDetailedError) ErrorMessage() string {
return e.Message
}