From 895c8f03c031a613f8f603eba753056ae4eb83b9 Mon Sep 17 00:00:00 2001 From: S7evinK Date: Mon, 1 Jun 2020 19:34:29 +0200 Subject: Fix pg user already exists (#1076) * Return newly created error if user already exists (#1002) Signed-off-by: Till Faelligen * Rename variable * Remove check for account and use returned error * Return ErrUserExists Signed-off-by: Till Faelligen * State that CreateAccount will return err ErrUserExists if the user exists Signed-off-by: Till Faelligen * Also check sqlite for constraint error * Revert "Also check sqlite for constraint error" This reverts commit 7d310514 * Check for sqlite3 constraint error * Add documentation to CreateAccount * Move ErrUserExists to accounts package * Revert "Move ErrUserExists to accounts package" Import Cycle.. This reverts commit be3d4cda Co-authored-by: Kegsay --- internal/sql.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'internal') diff --git a/internal/sql.go b/internal/sql.go index 546954bd..e3c10afc 100644 --- a/internal/sql.go +++ b/internal/sql.go @@ -26,6 +26,9 @@ import ( "go.uber.org/atomic" ) +// ErrUserExists is returned if a username already exists in the database. +var ErrUserExists = errors.New("Username already exists") + // A Transaction is something that can be committed or rolledback. type Transaction interface { // Commit the transaction -- cgit v1.2.3