2020-11-04 14:42:20 -05:00
|
|
|
package errors
|
|
|
|
|
|
2020-12-09 10:11:38 -08:00
|
|
|
// Info contains details of the specific error code
|
2020-11-04 14:42:20 -05:00
|
|
|
type Info struct {
|
2020-12-09 10:11:38 -08:00
|
|
|
// Kind specifies the kind of error (unknown, parameter, integrity, etc).
|
|
|
|
|
Kind Kind
|
|
|
|
|
|
|
|
|
|
// Message provides a default message for the error code
|
2020-11-04 14:42:20 -05:00
|
|
|
Message string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// errorCodeInfo provides a map of unique Codes (IDs) to their
|
|
|
|
|
// corresponding Kind and a default Message.
|
|
|
|
|
var errorCodeInfo = map[Code]Info{
|
|
|
|
|
Unknown: {
|
|
|
|
|
Message: "unknown",
|
|
|
|
|
Kind: Other,
|
|
|
|
|
},
|
|
|
|
|
InvalidParameter: {
|
|
|
|
|
Message: "invalid parameter",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
2020-12-09 10:11:38 -08:00
|
|
|
InvalidAddress: {
|
|
|
|
|
Message: "invalid address",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
|
|
|
|
InvalidPublicId: {
|
|
|
|
|
Message: "invalid public id",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
|
|
|
|
InvalidFieldMask: {
|
|
|
|
|
Message: "invalid field mask",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
|
|
|
|
EmptyFieldMask: {
|
|
|
|
|
Message: "empty field mask",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
2021-01-12 08:50:19 -08:00
|
|
|
KeyNotFound: {
|
|
|
|
|
Message: "key/version not found",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-01-13 15:50:07 -08:00
|
|
|
TicketAlreadyRedeemed: {
|
|
|
|
|
Message: "ticket already redeemed",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
TicketNotFound: {
|
|
|
|
|
Message: "ticket not found",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
Io: {
|
|
|
|
|
Message: "error during io operation",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-02-03 17:34:46 -06:00
|
|
|
InvalidTimeStamp: {
|
|
|
|
|
Message: "invalid time stamp",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-02-03 16:25:56 -08:00
|
|
|
SessionNotFound: {
|
|
|
|
|
Message: "session not found",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
InvalidSessionState: {
|
|
|
|
|
Message: "session state was not valid for the requested operation",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
TokenMismatch: {
|
|
|
|
|
Message: "token mismatch",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-02-11 13:32:45 -06:00
|
|
|
TooShort: {
|
|
|
|
|
Message: "too short",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-04-08 20:54:32 -04:00
|
|
|
AuthMethodInactive: {
|
|
|
|
|
Message: "authentication method is inactive",
|
|
|
|
|
Kind: State,
|
|
|
|
|
},
|
|
|
|
|
AuthAttemptExpired: {
|
|
|
|
|
Message: "authentication attempt has expired",
|
|
|
|
|
Kind: State,
|
|
|
|
|
},
|
2021-03-30 13:00:48 -07:00
|
|
|
AccountAlreadyAssociated: {
|
|
|
|
|
Message: "account already associated with another user",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
2021-05-06 14:54:10 -07:00
|
|
|
InvalidJobRunState: {
|
|
|
|
|
Message: "job run is already in a final run state",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-06-22 22:26:26 -04:00
|
|
|
JobAlreadyRunning: {
|
|
|
|
|
Message: "job already running",
|
|
|
|
|
Kind: State,
|
|
|
|
|
},
|
2021-07-27 09:59:52 -07:00
|
|
|
SubtypeAlreadyRegistered: {
|
|
|
|
|
Message: "subtype already registered",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
2021-06-22 22:26:26 -04:00
|
|
|
InvalidDynamicCredential: {
|
|
|
|
|
Message: "dynamic credential for session is in an invalid state",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2020-12-21 10:07:34 -08:00
|
|
|
PasswordTooShort: {
|
|
|
|
|
Message: "too short",
|
|
|
|
|
Kind: Password,
|
|
|
|
|
},
|
|
|
|
|
PasswordUnsupportedConfiguration: {
|
|
|
|
|
Message: "unable to support the password config type",
|
|
|
|
|
Kind: Password,
|
|
|
|
|
},
|
|
|
|
|
PasswordInvalidConfiguration: {
|
|
|
|
|
Message: "invalid parameters in password configuration",
|
|
|
|
|
Kind: Password,
|
|
|
|
|
},
|
|
|
|
|
PasswordsEqual: {
|
|
|
|
|
Message: "old and new password are equal",
|
|
|
|
|
Kind: Password,
|
|
|
|
|
},
|
2021-01-12 08:50:19 -08:00
|
|
|
Encrypt: {
|
|
|
|
|
Message: "error occurred during encrypt",
|
|
|
|
|
Kind: Encryption,
|
|
|
|
|
},
|
|
|
|
|
Decrypt: {
|
|
|
|
|
Message: "error occurred during decrypt",
|
|
|
|
|
Kind: Encryption,
|
|
|
|
|
},
|
2021-01-13 15:50:07 -08:00
|
|
|
Encode: {
|
|
|
|
|
Message: "error occurred during encode",
|
|
|
|
|
Kind: Encoding,
|
|
|
|
|
},
|
|
|
|
|
Decode: {
|
|
|
|
|
Message: "error occurred during decode",
|
|
|
|
|
Kind: Encoding,
|
|
|
|
|
},
|
2021-02-03 16:25:56 -08:00
|
|
|
GenKey: {
|
|
|
|
|
Message: "error occurred during key generation",
|
|
|
|
|
Kind: Encryption,
|
|
|
|
|
},
|
|
|
|
|
GenCert: {
|
|
|
|
|
Message: "error occurred during certification generation",
|
|
|
|
|
Kind: Encryption,
|
|
|
|
|
},
|
2021-03-20 06:52:47 -04:00
|
|
|
Internal: {
|
|
|
|
|
Message: "internal error",
|
|
|
|
|
Kind: Other,
|
|
|
|
|
},
|
|
|
|
|
Forbidden: {
|
|
|
|
|
Message: "forbidden",
|
|
|
|
|
Kind: Other,
|
|
|
|
|
},
|
2021-10-19 17:21:41 -04:00
|
|
|
Unauthorized: {
|
|
|
|
|
Message: "unauthorized",
|
|
|
|
|
Kind: Other,
|
|
|
|
|
},
|
2020-11-04 14:42:20 -05:00
|
|
|
CheckConstraint: {
|
|
|
|
|
Message: "constraint check failed",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
NotNull: {
|
|
|
|
|
Message: "must not be empty (null) violation",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
NotUnique: {
|
|
|
|
|
Message: "must be unique violation",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
NotSpecificIntegrity: {
|
|
|
|
|
Message: "Integrity violation without specific details",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
MissingTable: {
|
|
|
|
|
Message: "missing table",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2020-12-21 10:07:34 -08:00
|
|
|
ColumnNotFound: {
|
|
|
|
|
Message: "column not found",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2020-11-04 14:42:20 -05:00
|
|
|
RecordNotFound: {
|
|
|
|
|
Message: "record not found",
|
|
|
|
|
Kind: Search,
|
|
|
|
|
},
|
|
|
|
|
MultipleRecords: {
|
|
|
|
|
Message: "multiple records",
|
|
|
|
|
Kind: Search,
|
|
|
|
|
},
|
2020-12-21 10:07:34 -08:00
|
|
|
Exception: {
|
|
|
|
|
Message: "db exception",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-04-08 20:54:32 -04:00
|
|
|
VersionMismatch: {
|
|
|
|
|
Message: "version mismatch",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2020-12-21 10:07:34 -08:00
|
|
|
MaxRetries: {
|
|
|
|
|
Message: "too many retries",
|
|
|
|
|
Kind: Transaction,
|
|
|
|
|
},
|
2021-01-19 10:40:41 -07:00
|
|
|
MigrationIntegrity: {
|
|
|
|
|
Message: "migration integrity",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
|
|
|
|
MigrationLock: {
|
|
|
|
|
Message: "bad db lock",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-04-07 14:50:00 -04:00
|
|
|
Unavailable: {
|
|
|
|
|
Message: "external system unavailable",
|
|
|
|
|
Kind: External,
|
|
|
|
|
},
|
2021-06-22 22:26:26 -04:00
|
|
|
VaultTokenNotOrphan: {
|
|
|
|
|
Message: "vault token is not an orphan token",
|
|
|
|
|
Kind: VaultToken,
|
|
|
|
|
},
|
|
|
|
|
VaultTokenNotPeriodic: {
|
|
|
|
|
Message: "vault token is not a periodic token",
|
|
|
|
|
Kind: VaultToken,
|
|
|
|
|
},
|
|
|
|
|
VaultTokenNotRenewable: {
|
|
|
|
|
Message: "vault token is not renewable",
|
|
|
|
|
Kind: VaultToken,
|
|
|
|
|
},
|
|
|
|
|
VaultTokenMissingCapabilities: {
|
|
|
|
|
Message: "vault token is missing capabilities",
|
|
|
|
|
Kind: VaultToken,
|
|
|
|
|
},
|
|
|
|
|
VaultCredentialRequest: {
|
|
|
|
|
Message: "request for a new credential from vault failed",
|
|
|
|
|
Kind: External,
|
|
|
|
|
},
|
2021-12-15 15:52:28 -08:00
|
|
|
VaultEmptySecret: {
|
|
|
|
|
Message: "vault secret is empty",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-10-11 16:16:02 -04:00
|
|
|
VaultInvalidMappingOverride: {
|
|
|
|
|
Message: "invalid credential mapping override",
|
|
|
|
|
Kind: Parameter,
|
|
|
|
|
},
|
2021-11-10 06:47:21 -05:00
|
|
|
VaultInvalidCredentialMapping: {
|
|
|
|
|
Message: "mapping vault secret to a credential type failed",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2021-04-29 14:47:13 -07:00
|
|
|
OidcProviderCallbackError: {
|
|
|
|
|
Message: "oidc provider callback error",
|
|
|
|
|
Kind: External,
|
|
|
|
|
},
|
2021-06-01 14:18:10 -05:00
|
|
|
GracefullyAborted: {
|
|
|
|
|
Message: "purposefully aborted without error",
|
|
|
|
|
Kind: Other,
|
|
|
|
|
},
|
2021-10-28 10:09:43 -04:00
|
|
|
UnexpectedRowsAffected: {
|
|
|
|
|
Message: "unexpected number of rows affected",
|
|
|
|
|
Kind: Integrity,
|
|
|
|
|
},
|
2020-11-04 14:42:20 -05:00
|
|
|
}
|