github.com/greenpau/go-identity@v1.1.6/pkg/errors/database.go (about)

     1  // Copyright 2020 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  	ErrUserPasswordNotFound StandardError = "user password not set"
    43  	ErrUserPasswordInvalid  StandardError = "user password is invalid"
    44  
    45  	ErrUserPolicyCompliance     StandardError = "username policy compliance check failed"
    46  	ErrPasswordPolicyCompliance StandardError = "user password policy compliance check failed"
    47  
    48  	ErrAddUser    StandardError = "failed adding user %q: %v"
    49  	ErrDeleteUser StandardError = "failed deleting user %q: %v"
    50  	ErrGetUsers   StandardError = "failed retrieving users: %v"
    51  	ErrGetUser    StandardError = "failed retrieving user %q: %v"
    52  
    53  	ErrPasswordEmpty                StandardError = "empty password"
    54  	ErrPasswordEmptyAlgorithm       StandardError = "empty password hash algorithm"
    55  	ErrPasswordGenerate             StandardError = "password generation error: %v"
    56  	ErrPasswordUnsupportedAlgorithm StandardError = "unsupported password hash algorithm: %v"
    57  
    58  	ErrUserIDInvalidLength StandardError = "invalid user id length: %d"
    59  	ErrUsernameEmpty       StandardError = "username is empty"
    60  
    61  	ErrEmailAddressInvalid StandardError = "invalid email address"
    62  	ErrRoleEmpty           StandardError = "role name is empty"
    63  
    64  	ErrParseNameFailed StandardError = "failed to parse name: %s"
    65  
    66  	ErrCreditCardUnsupportedIssuer      StandardError = "unsupported credit card issuer: %v"
    67  	ErrCreditCardUnsupportedAssociation StandardError = "unsupported credit card association: %v"
    68  )