diff options
author | =Corey Hulen <corey@hulen.com> | 2016-03-16 18:13:16 -0700 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-03-16 18:13:16 -0700 |
commit | b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220 (patch) | |
tree | 85d2c293aa3456182a754fefe6646162b516eb6c /store | |
parent | e101b2cf7c172d1c4ff20e0df63917b5b8f923ed (diff) | |
parent | cba59d4eb6ef0f65304bc72339c676ebfd653e2b (diff) | |
download | chat-b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220.tar.gz chat-b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220.tar.bz2 chat-b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220.zip |
merging files
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_user_store.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 47c6ea61a..cc6829b94 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -4,6 +4,7 @@ package store import ( + "database/sql" "fmt" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" @@ -11,7 +12,8 @@ import ( ) const ( - MISSING_ACCOUNT_ERROR = "store.sql_user.missing_account.const" + MISSING_ACCOUNT_ERROR = "store.sql_user.missing_account.const" + MISSING_AUTH_ACCOUNT_ERROR = "store.sql_user.get_by_auth.missing_account.app_error" ) type SqlUserStore struct { @@ -481,8 +483,11 @@ func (us SqlUserStore) GetByAuth(teamId string, authData string, authService str user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND AuthData = :AuthData AND AuthService = :AuthService", map[string]interface{}{"TeamId": teamId, "AuthData": authData, "AuthService": authService}); err != nil { - result.Err = model.NewLocAppError("SqlUserStore.GetByAuth", "store.sql_user.get_by_auth.app_error", - nil, "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) + if err == sql.ErrNoRows { + result.Err = model.NewLocAppError("SqlUserStore.GetByAuth", MISSING_AUTH_ACCOUNT_ERROR, nil, "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) + } else { + result.Err = model.NewLocAppError("SqlUserStore.GetByAuth", "store.sql_user.get_by_auth.other.app_error", nil, "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) + } } result.Data = &user |