Skip to content

Commit

Permalink
fix: JS API viewports should throw only for basic data issues (#6535)
Browse files Browse the repository at this point in the history
Network issues now fire requestfailed events to signal that the table
was in a bad state.

Fixes DH-18331
  • Loading branch information
niloc132 authored Jan 8, 2025
1 parent dd72175 commit fc40e1d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ public void setInternalViewport(double firstRow, double lastRow, Column[] column
Boolean isReverseViewport) {
// Until we've created the stream, we just cache the requested viewport
if (status == Status.STARTING) {
if (firstRow < 0 || firstRow > lastRow) {
throw new IllegalArgumentException("Invalid viewport row range: " + firstRow + " to " + lastRow);
}
this.firstRow = firstRow;
this.lastRow = lastRow;
this.columns = columns;
Expand All @@ -273,8 +276,12 @@ public void setInternalViewport(double firstRow, double lastRow, Column[] column
isReverseViewport = false;
}
RangeSet viewport = RangeSet.ofRange((long) firstRow, (long) lastRow);
this.sendBarrageSubscriptionRequest(viewport, Js.uncheckedCast(columns), updateIntervalMs,
isReverseViewport);
try {
this.sendBarrageSubscriptionRequest(viewport, Js.uncheckedCast(columns), updateIntervalMs,
isReverseViewport);
} catch (Exception e) {
fireEvent(JsTable.EVENT_REQUEST_FAILED, e.getMessage());
}
}

/**
Expand Down

0 comments on commit fc40e1d

Please sign in to comment.