Migrate GetChannels method from ChannelStore to return error interface (#14711)
* Migrate GetChannels method from ChannelStore to return error interface * Fix testing * Changed error type: ErrInvalidInput -> ErrNotFound * Added note about error migrations * Fix en.json * Fix i18n Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9b0ae49b55
Коммит
41d9c673cf
@@ -1551,7 +1551,18 @@ func (a *App) GetChannelByNameForTeamName(channelName, teamName string, includeD
|
||||
}
|
||||
|
||||
func (a *App) GetChannelsForUser(teamId string, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
|
||||
return a.Srv().Store.Channel().GetChannels(teamId, userId, includeDeleted)
|
||||
list, err := a.Srv().Store.Channel().GetChannels(teamId, userId, includeDeleted)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("GetChannelsForUser", "app.channel.get_channels.not_found.app_error", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("GetChannelsForUser", "app.channel.get_channels.get.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, *model.AppError) {
|
||||
|
||||
Ссылка в новой задаче
Block a user