feat(errors): Add code for invalid configuration
This commit is contained in:
5 files changed
+30
-11
No files matched your search
@@ -146,4 +146,7 @@ const (
|
||||
|
||||
// OIDC authentication provided errors
|
||||
OidcProviderCallbackError Code = 4000 // OidcProviderCallbackError represents an error that is passed by the OIDC provider to the callback endpoint
|
||||
|
||||
// Configuration error codes
|
||||
InvalidConfiguration Code = 5000 // InvalidConfiguration represents an error with the configuration file.
|
||||
)
|
||||
@@ -410,6 +410,11 @@ func TestCode_Both_String_Info(t *testing.T) {
|
||||
c: ChecksumMismatch,
|
||||
want: ChecksumMismatch,
|
||||
},
|
||||
{
|
||||
name: "InvalidConfiguration",
|
||||
c: InvalidConfiguration,
|
||||
want: InvalidConfiguration,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
@@ -343,4 +343,8 @@ var errorCodeInfo = map[Code]Info{
|
||||
Message: "checksum mismatch",
|
||||
Kind: Integrity,
|
||||
},
|
||||
InvalidConfiguration: {
|
||||
Message: "invalid configuration",
|
||||
Kind: Configuration,
|
||||
},
|
||||
}
|
||||
+13
-11
@@ -18,20 +18,22 @@ const (
|
||||
State
|
||||
External
|
||||
VaultToken
|
||||
Configuration
|
||||
)
|
||||
|
||||
func (e Kind) String() string {
|
||||
return map[Kind]string{
|
||||
Other: "unknown",
|
||||
Parameter: "parameter violation",
|
||||
Integrity: "integrity violation",
|
||||
Search: "search issue",
|
||||
Password: "password violation",
|
||||
Transaction: "db transaction issue",
|
||||
Encryption: "encryption issue",
|
||||
Encoding: "encoding issue",
|
||||
State: "state violation",
|
||||
External: "external system issue",
|
||||
VaultToken: "vault token issue",
|
||||
Other: "unknown",
|
||||
Parameter: "parameter violation",
|
||||
Integrity: "integrity violation",
|
||||
Search: "search issue",
|
||||
Password: "password violation",
|
||||
Transaction: "db transaction issue",
|
||||
Encryption: "encryption issue",
|
||||
Encoding: "encoding issue",
|
||||
State: "state violation",
|
||||
External: "external system issue",
|
||||
VaultToken: "vault token issue",
|
||||
Configuration: "configuration issue",
|
||||
}[e]
|
||||
}
|
||||
@@ -46,6 +46,11 @@ func TestKind_String(t *testing.T) {
|
||||
e: VaultToken,
|
||||
want: "vault token issue",
|
||||
},
|
||||
{
|
||||
name: "Configuration",
|
||||
e: Configuration,
|
||||
want: "configuration issue",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user