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