fix(storage): use lower case in error messages (#2145)

Co-authored-by: James Elliott <james-d-elliott@users.noreply.github.com>
Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
pull/2210/head^2
Clément Michaud 2021-08-04 01:36:53 +02:00 committed by GitHub
parent 4a570489d1
commit e693302c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -4,8 +4,8 @@ import "errors"
var ( var (
// ErrNoU2FDeviceHandle error thrown when no U2F device handle has been found in DB. // ErrNoU2FDeviceHandle error thrown when no U2F device handle has been found in DB.
ErrNoU2FDeviceHandle = errors.New("No U2F device handle found") ErrNoU2FDeviceHandle = errors.New("no U2F device handle found")
// ErrNoTOTPSecret error thrown when no TOTP secret has been found in DB. // ErrNoTOTPSecret error thrown when no TOTP secret has been found in DB.
ErrNoTOTPSecret = errors.New("No TOTP secret registered") ErrNoTOTPSecret = errors.New("no TOTP secret registered")
) )

View File

@ -272,7 +272,7 @@ func TestSQLProviderMethodsTOTP(t *testing.T) {
// Test Blank Rows // Test Blank Rows
secret, err = provider.LoadTOTPSecret(unitTestUser) secret, err = provider.LoadTOTPSecret(unitTestUser)
assert.EqualError(t, err, "No TOTP secret registered") assert.EqualError(t, err, "no TOTP secret registered")
assert.Equal(t, "", secret) assert.Equal(t, "", secret)
} }
@ -332,7 +332,7 @@ func TestSQLProviderMethodsU2F(t *testing.T) {
WillReturnRows(sqlmock.NewRows([]string{"keyHandle", "publicKey"})) WillReturnRows(sqlmock.NewRows([]string{"keyHandle", "publicKey"}))
keyHandle, publicKey, err = provider.LoadU2FDeviceHandle(unitTestUser) keyHandle, publicKey, err = provider.LoadU2FDeviceHandle(unitTestUser)
assert.EqualError(t, err, "No U2F device handle found") assert.EqualError(t, err, "no U2F device handle found")
assert.Equal(t, []byte(nil), keyHandle) assert.Equal(t, []byte(nil), keyHandle)
assert.Equal(t, []byte(nil), publicKey) assert.Equal(t, []byte(nil), publicKey)
} }

View File

@ -19,7 +19,7 @@ func (p *SQLProvider) upgradeCreateTableStatements(tx transaction, statements ma
if !utils.IsStringInSlice(table, existingTables) { if !utils.IsStringInSlice(table, existingTables) {
_, err := tx.Exec(fmt.Sprintf(statements[table], table)) _, err := tx.Exec(fmt.Sprintf(statements[table], table))
if err != nil { if err != nil {
return fmt.Errorf("Unable to create table %s: %v", table, err) return fmt.Errorf("unable to create table %s: %v", table, err)
} }
} }
} }
@ -63,7 +63,7 @@ func (p *SQLProvider) upgradeSchemaToVersion001(tx transaction, tables []string)
if p.name != "mysql" { if p.name != "mysql" {
err = p.upgradeRunMultipleStatements(tx, p.sqlUpgradesCreateTableIndexesStatements[1]) err = p.upgradeRunMultipleStatements(tx, p.sqlUpgradesCreateTableIndexesStatements[1])
if err != nil { if err != nil {
return fmt.Errorf("Unable to create index: %v", err) return fmt.Errorf("unable to create index: %v", err)
} }
} }