diff options
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_file_info_store.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/store/sql_file_info_store.go b/store/sql_file_info_store.go index c29ac461e..467ae39aa 100644 --- a/store/sql_file_info_store.go +++ b/store/sql_file_info_store.go @@ -3,6 +3,9 @@ package store import ( + "database/sql" + "net/http" + "github.com/mattermost/platform/einterfaces" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" @@ -91,7 +94,11 @@ func (fs SqlFileInfoStore) Get(id string) StoreChannel { WHERE Id = :Id AND DeleteAt = 0`, map[string]interface{}{"Id": id}); err != nil { - result.Err = model.NewLocAppError("SqlFileInfoStore.Get", "store.sql_file_info.get.app_error", nil, "id="+id+", "+err.Error()) + if err == sql.ErrNoRows { + result.Err = model.NewAppError("SqlFileInfoStore.Get", "store.sql_file_info.get.app_error", nil, "id="+id+", "+err.Error(), http.StatusNotFound) + } else { + result.Err = model.NewLocAppError("SqlFileInfoStore.Get", "store.sql_file_info.get.app_error", nil, "id="+id+", "+err.Error()) + } } else { result.Data = info } |