forked from arrikto/oidc-authservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
55 lines (43 loc) · 1.11 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
package main
import (
"fmt"
"net/http"
)
var _ error = &requestError{}
type requestError struct {
Response *http.Response
Body []byte
Err error
}
func (e *requestError) Error() string {
return fmt.Sprintf("status: %d, body: %s, err: %v", e.Response.StatusCode,
e.Body, e.Err)
}
func (e *requestError) Unwrap() error {
return e.Err
}
var _ error = &loginExpiredError{}
// loginExpiredError is used by authenticators to inform the calling code
// that the provided credentials were recognized but the login has expired
type loginExpiredError struct {
Err error
}
func (e *loginExpiredError) Error() string {
return e.Err.Error()
}
func (e *loginExpiredError) Unwrap() error {
return e.Err
}
// The authenticatorSpecificError type is used to inform the calling code
// that the appropriate authentication method failed to authenticate the
// request.
// No other authentication method needs to be tested.
type authenticatorSpecificError struct {
Err error
}
func (e *authenticatorSpecificError) Error() string {
return e.Err.Error()
}
func (e *authenticatorSpecificError) Unwrap() error {
return e.Err
}