Skip to content

Commit

Permalink
Pass errors to cluster function callbacks (mapbox#9251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hamley authored and mike-unearth committed Mar 18, 2020
1 parent c5df8f9 commit d36476e
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 d36476e

Please sign in to comment.