-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patherror.go
More file actions
117 lines (103 loc) · 3.16 KB
/
error.go
File metadata and controls
117 lines (103 loc) · 3.16 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
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
107
108
109
110
111
112
113
114
115
116
117
package oidfed
// ErrorResponse is type for holding an Error including the status code
type ErrorResponse struct {
*Error
Status int `json:"-"`
}
// Error is type for holding an error
type Error struct {
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
}
// Constants for some error
const (
InvalidRequest = "invalid_request"
InvalidClient = "invalid_client"
InvalidIssuer = "invalid_issuer"
InvalidSubject = "invalid_subject"
InvalidTrustAnchor = "invalid_trust_anchor"
InvalidTrustChain = "invalid_trust_chain"
InvalidMetadata = "invalid_metadata"
NotFound = "not_found"
ServerError = "server_error"
TemporarilyUnavailable = "temporarily_unavailable"
UnsupportedParameter = "unsupported_parameter"
EntityIDNotFound = "entity_id_not_found"
)
// ErrorInvalidRequest returns an Error for using InvalidRequest
func ErrorInvalidRequest(description string) *Error {
return &Error{
Error: InvalidRequest,
ErrorDescription: description,
}
}
// ErrorInvalidClient returns an Error for using InvalidClient
func ErrorInvalidClient(description string) *Error {
return &Error{
Error: InvalidClient,
ErrorDescription: description,
}
}
// ErrorInvalidIssuer returns an Error for using InvalidIssuer
func ErrorInvalidIssuer(description string) *Error {
return &Error{
Error: InvalidIssuer,
ErrorDescription: description,
}
}
// ErrorInvalidSubject returns an Error for using InvalidSubject
func ErrorInvalidSubject(description string) *Error {
return &Error{
Error: InvalidSubject,
ErrorDescription: description,
}
}
// ErrorInvalidTrustAnchor returns an Error for using InvalidTrustAnchor
func ErrorInvalidTrustAnchor(description string) *Error {
return &Error{
Error: InvalidTrustAnchor,
ErrorDescription: description,
}
}
// ErrorInvalidTrustChain returns an Error for using InvalidTrustChain
func ErrorInvalidTrustChain(description string) *Error {
return &Error{
Error: InvalidTrustChain,
ErrorDescription: description,
}
}
// ErrorInvalidMetadata returns an Error for using InvalidMetadata
func ErrorInvalidMetadata(description string) *Error {
return &Error{
Error: InvalidMetadata,
ErrorDescription: description,
}
}
// ErrorNotFound returns an Error for using NotFound
func ErrorNotFound(description string) *Error {
return &Error{
Error: NotFound,
ErrorDescription: description,
}
}
// ErrorServerError returns an Error for using ServerError
func ErrorServerError(description string) *Error {
return &Error{
Error: ServerError,
ErrorDescription: description,
}
}
// ErrorUnsupportedParameter returns an Error for using UnsupportedParameter
func ErrorUnsupportedParameter(description string) *Error {
return &Error{
Error: UnsupportedParameter,
ErrorDescription: description,
}
}
// ErrorTemporarilyUnavailable returns an Error for using TemporarilyUnavailable
func ErrorTemporarilyUnavailable(description string) *Error {
return &Error{
Error: TemporarilyUnavailable,
ErrorDescription: description,
}
}