Skip to content

Commit

Permalink
Merge branch 'hotfix/empty-fills' into hotfix/empty-swap2
Browse files Browse the repository at this point in the history
  • Loading branch information
uv-orbs committed Mar 27, 2024
2 parents 5779805 + c36327c commit 8389146
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion service/get_orders_for_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *Service) GetSwapFills(ctx context.Context, userId uuid.UUID, symbol mod

if len(swapIds) == 0 {
logctx.Warn(ctx, "user has no resolved swaps", logger.Error(err), logger.String("user_id", userId.String()))
return []models.Fill{}, models.ErrNotFound
return []models.Fill{}, nil
}

fills := []models.Fill{}
Expand Down
6 changes: 4 additions & 2 deletions transport/rest/get_orders_for_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ func (h *Handler) GetSwapFills(w http.ResponseWriter, r *http.Request) {
fills, err := h.svc.GetSwapFills(r.Context(), user.Id, symbol, startAt, endAt)
if err != nil {
logctx.Error(r.Context(), "failed GetSwapFills", logger.Error(err), logger.String("userId", user.Id.String()))
if err == models.ErrMaxRecExceeded {
switch err {
case models.ErrMaxRecExceeded:
// narrow down the time range, 256 exceeded
restutils.WriteJSONError(ctx, w, http.StatusRequestEntityTooLarge, err.Error())
} else {
default:
restutils.WriteJSONError(ctx, w, http.StatusInternalServerError, "Error getting swaps. Try again later")
}
return
}
jsonData, err := json.Marshal(fills)
if err != nil {
Expand Down

0 comments on commit 8389146

Please sign in to comment.