Skip to content

Commit

Permalink
fix: Reject instead of returning a null table
Browse files Browse the repository at this point in the history
- Returning a `null` instead of an actual table is weird. Throw to indicate the key could not be found.
  • Loading branch information
mofojed committed Jan 18, 2024
1 parent 7923787 commit f387412
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public Promise<JsTable> getTable(Object key) {
}
final List<Object> keyList = Js.<JsArray<Object>>uncheckedCast(key).asList();
if (!knownKeys.contains(keyList)) {
// key doesn't even exist, just hand back a null table
return Promise.resolve((JsTable) null);
// key doesn't even exist
return Promise.reject("Key not found");
}
final String[] columnNames = descriptor.getKeyColumnNamesList().asArray(new String[0]);
final String[] columnTypes = keyColumnTypes.toArray(new String[0]);
Expand Down

0 comments on commit f387412

Please sign in to comment.