Fix incorrect error handling (#15502)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f3cb2538a7
Коммит
5c449f4202
@@ -1980,19 +1980,19 @@ func (a *App) LeaveChannel(channelId string, userId string) *model.AppError {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
cresult := <-sc
|
cresult := <-sc
|
||||||
if cresult.Err != nil {
|
if cresult.NErr != nil {
|
||||||
return cresult.Err
|
|
||||||
}
|
|
||||||
uresult := <-uc
|
|
||||||
if uresult.NErr != nil {
|
|
||||||
var nfErr *store.ErrNotFound
|
var nfErr *store.ErrNotFound
|
||||||
switch {
|
switch {
|
||||||
case errors.As(uresult.NErr, &nfErr):
|
case errors.As(cresult.NErr, &nfErr):
|
||||||
return model.NewAppError("LeaveChannel", "app.channel.get.existing.app_error", nil, nfErr.Error(), http.StatusNotFound)
|
return model.NewAppError("LeaveChannel", "app.channel.get.existing.app_error", nil, nfErr.Error(), http.StatusNotFound)
|
||||||
default:
|
default:
|
||||||
return model.NewAppError("LeaveChannel", "app.channel.get.find.app_error", nil, uresult.NErr.Error(), http.StatusInternalServerError)
|
return model.NewAppError("LeaveChannel", "app.channel.get.find.app_error", nil, cresult.NErr.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uresult := <-uc
|
||||||
|
if uresult.Err != nil {
|
||||||
|
return uresult.Err
|
||||||
|
}
|
||||||
ccresult := <-mcc
|
ccresult := <-mcc
|
||||||
if ccresult.NErr != nil {
|
if ccresult.NErr != nil {
|
||||||
return model.NewAppError("LeaveChannel", "app.channel.get_member_count.app_error", nil, ccresult.NErr.Error(), http.StatusInternalServerError)
|
return model.NewAppError("LeaveChannel", "app.channel.get_member_count.app_error", nil, ccresult.NErr.Error(), http.StatusInternalServerError)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user