github.com/greenpau/go-authcrunch@v1.0.50/pkg/errors/database.go (about) 1 // Copyright 2022 Paul Greenberg greenpau@outlook.com 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package errors 16 17 // Database errors. 18 const ( 19 ErrNewDatabase StandardError = "failed initializing database at %q: %v" 20 ErrNewDatabaseInvalidUser StandardError = "failed initializing database: found invalid user %v, %v" 21 ErrNewDatabaseDuplicateUser StandardError = "failed initializing database: found duplicate user %s %v" 22 ErrNewDatabaseDuplicateUserID StandardError = "failed initializing database: found duplicate user id %s %v" 23 ErrNewDatabaseDuplicateEmail StandardError = "failed initializing database: found duplicate email address %s, %v" 24 ErrNewDatabaseDuplicateAPIKey StandardError = "failed initializing database: found duplicate api key %s, %v" 25 26 ErrDatabaseCommit StandardError = "failed database commit to %q: %v" 27 ErrDatabaseOperation StandardError = "database operation failed: %v" 28 ErrDatabaseInvalidUser StandardError = "username and email point to a different identity in the database" 29 ErrDatabaseUserNotFound StandardError = "user not found" 30 // ErrDatabaseInvalidUserPassword StandardError = "invalid password" 31 ErrAuthFailed StandardError = "user authentication failed: %v" 32 33 ErrAddPublicKey StandardError = "failed adding %s public key: %v" 34 ErrDeletePublicKey StandardError = "failed deleting %q key: %v" 35 ErrGetPublicKeys StandardError = "failed getting %q keys: %v" 36 37 ErrAddAPIKey StandardError = "failed adding %s key: %v" 38 ErrDeleteAPIKey StandardError = "failed deleting %q key: %v" 39 ErrGetAPIKeys StandardError = "failed getting %q keys: %v" 40 41 ErrChangeUserPassword StandardError = "failed change user password: %v" 42 ErrUpdateUserPassword StandardError = "failed updating user password: %v" 43 ErrUserPasswordNotFound StandardError = "user password not set" 44 ErrUserPasswordInvalid StandardError = "user password is invalid" 45 46 ErrUserPolicyCompliance StandardError = "username policy compliance check failed" 47 ErrPasswordPolicyCompliance StandardError = "user password policy compliance check failed" 48 49 ErrAddUser StandardError = "failed adding user %q: %v" 50 ErrDeleteUser StandardError = "failed deleting user %q: %v" 51 ErrGetUsers StandardError = "failed retrieving users: %v" 52 ErrGetUser StandardError = "failed retrieving user %q: %v" 53 54 ErrPasswordEmpty StandardError = "empty password" 55 ErrPasswordEmptyAlgorithm StandardError = "empty password hash algorithm" 56 ErrPasswordGenerate StandardError = "password generation error: %v" 57 ErrPasswordUnsupportedAlgorithm StandardError = "unsupported password hash algorithm: %v" 58 ErrPasswordHashed StandardError = "failed handling hashed password: %v" 59 60 ErrUserIDInvalidLength StandardError = "invalid user id length: %d" 61 ErrUsernameEmpty StandardError = "username is empty" 62 63 ErrEmailAddressInvalid StandardError = "invalid email address" 64 ErrRoleEmpty StandardError = "role name is empty" 65 66 ErrParseNameFailed StandardError = "failed to parse name: %s" 67 68 ErrCreditCardUnsupportedIssuer StandardError = "unsupported credit card issuer: %v" 69 ErrCreditCardUnsupportedAssociation StandardError = "unsupported credit card association: %v" 70 )