Consistent error wrapping (#30600)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
64ff2434ee
Коммит
354d7aeb72
@@ -7940,8 +7940,8 @@ func (c *Client4) RestoreGroup(ctx context.Context, groupID string, etag string)
|
||||
}
|
||||
defer closeBody(r)
|
||||
var p Group
|
||||
if jsonErr := json.NewDecoder(r.Body).Decode(&p); jsonErr != nil {
|
||||
return nil, nil, NewAppError("DeleteGroup", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
|
||||
if err := json.NewDecoder(r.Body).Decode(&p); err != nil {
|
||||
return nil, nil, NewAppError("DeleteGroup", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return &p, BuildResponse(r), nil
|
||||
}
|
||||
@@ -9241,8 +9241,8 @@ func (c *Client4) AcknowledgePost(ctx context.Context, postId, userId string) (*
|
||||
}
|
||||
defer closeBody(r)
|
||||
var ack *PostAcknowledgement
|
||||
if jsonErr := json.NewDecoder(r.Body).Decode(&ack); jsonErr != nil {
|
||||
return nil, nil, NewAppError("AcknowledgePost", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
|
||||
if err := json.NewDecoder(r.Body).Decode(&ack); err != nil {
|
||||
return nil, nil, NewAppError("AcknowledgePost", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return ack, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
@@ -4370,7 +4370,7 @@ func (s *ServiceSettings) isValid() *AppError {
|
||||
parent := filepath.Dir(*s.LocalModeSocketLocation)
|
||||
_, err := os.Stat(parent)
|
||||
if err != nil {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.local_mode_socket.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.local_mode_socket.app_error", nil, err.Error(), http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user