diff options
author | Julien Dessaux | 2021-09-13 22:20:12 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-09-13 22:20:29 +0200 |
commit | 2a36446a9ff1196307f240fa712d80abd19ed93a (patch) | |
tree | ff6e6edc5fede81a4f5725a0292b4167a0d64c0c /pkg/database/error.go | |
parent | Piece evry last week changes together in a big rewrite of the webui (diff) | |
download | trains-2a36446a9ff1196307f240fa712d80abd19ed93a.tar.gz trains-2a36446a9ff1196307f240fa712d80abd19ed93a.tar.bz2 trains-2a36446a9ff1196307f240fa712d80abd19ed93a.zip |
Rewrote database package tests for consistency
Diffstat (limited to '')
-rw-r--r-- | pkg/database/error.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pkg/database/error.go b/pkg/database/error.go index 0c19752..bbf4d69 100644 --- a/pkg/database/error.go +++ b/pkg/database/error.go @@ -8,10 +8,10 @@ type InitError struct { err error } -func (e *InitError) Error() string { +func (e InitError) Error() string { return fmt.Sprintf("Failed to open database : %s", e.path) } -func (e *InitError) Unwrap() error { return e.err } +func (e InitError) Unwrap() error { return e.err } func newInitError(path string, err error) error { return &InitError{ @@ -26,10 +26,10 @@ type MigrationError struct { err error } -func (e *MigrationError) Error() string { +func (e MigrationError) Error() string { return fmt.Sprintf("Failed to migrate database to version %d : %s", e.version, e.err) } -func (e *MigrationError) Unwrap() error { return e.err } +func (e MigrationError) Unwrap() error { return e.err } func newMigrationError(version int, err error) error { return &MigrationError{ @@ -43,10 +43,10 @@ type PasswordError struct { err error } -func (e *PasswordError) Error() string { +func (e PasswordError) Error() string { return fmt.Sprintf("Failed to hash password : %+v", e.err) } -func (e *PasswordError) Unwrap() error { return e.err } +func (e PasswordError) Unwrap() error { return e.err } func newPasswordError(err error) error { return &PasswordError{ @@ -60,10 +60,10 @@ type QueryError struct { err error } -func (e *QueryError) Error() string { +func (e QueryError) Error() string { return fmt.Sprintf("Failed to perform query : %s", e.msg) } -func (e *QueryError) Unwrap() error { return e.err } +func (e QueryError) Unwrap() error { return e.err } func newQueryError(msg string, err error) error { return &QueryError{ @@ -78,10 +78,10 @@ type TransactionError struct { err error } -func (e *TransactionError) Error() string { +func (e TransactionError) Error() string { return fmt.Sprintf("Failed to perform query : %s", e.msg) } -func (e *TransactionError) Unwrap() error { return e.err } +func (e TransactionError) Unwrap() error { return e.err } func newTransactionError(msg string, err error) error { return &TransactionError{ |