/
errors.go
48 lines (37 loc) · 1005 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package connection
import (
"errors"
"fmt"
)
// AuthError defines an Authentication error
type AuthError struct {
Err error
}
type MasAuthError struct {
Err error
}
func (e *AuthError) Error() string {
return fmt.Sprintf("%v", e.Err)
}
func (e *MasAuthError) Unwrap() error {
return e.Err
}
func (e *MasAuthError) Error() string {
return fmt.Sprintf("%v", e.Err)
}
func (e *AuthError) Unwrap() error {
return e.Err
}
func AuthErrorf(format string, a ...interface{}) *AuthError {
err := fmt.Errorf(format, a...)
return &AuthError{err}
}
func notLoggedInError() error {
return errors.New(`not logged in. Run "rhoas login" to authenticate`)
}
func notLoggedInMASError() error {
return errors.New(`not logged in to identity.api.openshift.com. Run "rhoas login" to authenticate. Note: token-based login is not supported by the Kafka "topic" and "consumergroup" subcommands`)
}
func sessionExpiredError() error {
return errors.New(`session expired. Run "rhoas login" to authenticate`)
}