Skip to content

Commit

Permalink
Pass errors to cluster function callbacks (#9251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hamley authored Feb 3, 2020
1 parent 6e8e601 commit 544e32b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/source/geojson_worker_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,27 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
}

getClusterExpansionZoom(params: {clusterId: number}, callback: Callback<number>) {
callback(null, this._geoJSONIndex.getClusterExpansionZoom(params.clusterId));
try {
callback(null, this._geoJSONIndex.getClusterExpansionZoom(params.clusterId));
} catch (e) {
callback(e);
}
}

getClusterChildren(params: {clusterId: number}, callback: Callback<Array<GeoJSONFeature>>) {
callback(null, this._geoJSONIndex.getChildren(params.clusterId));
try {
callback(null, this._geoJSONIndex.getChildren(params.clusterId));
} catch (e) {
callback(e);
}
}

getClusterLeaves(params: {clusterId: number, limit: number, offset: number}, callback: Callback<Array<GeoJSONFeature>>) {
callback(null, this._geoJSONIndex.getLeaves(params.clusterId, params.limit, params.offset));
try {
callback(null, this._geoJSONIndex.getLeaves(params.clusterId, params.limit, params.offset));
} catch (e) {
callback(e);
}
}
}

Expand Down

0 comments on commit 544e32b

Please sign in to comment.