-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
try/catch extent() #124
try/catch extent() #124
Conversation
Can you add a block comment documenting why that |
@@ -62,7 +62,12 @@ function search( docs, params ){ | |||
var geojson = GeoJSON.parse( geodata, { Point: ['lat', 'lng'] }); | |||
|
|||
// add bbox | |||
geojson.bbox = extent( geojson ) || undefined; | |||
try { | |||
geojson.bbox = extent( geojson ) || undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks a bit odd to have the ||
conditional inside a try/catch and after the thing that might throw. would be cleaner as
geojson.bbox = undefined;
try {
geojson.bbox = extent( geojson )
}
catch (e) {
// ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, I think this is because extent()
can return null
which ends up in the JSON payload, I totally agree it doesn't feel right, will give it a rejig.
thanks for the rejig. 👍 |
+1 |
$ npm publish
npm http PUT https://registry.npmjs.org/pelias-api
npm http 200 https://registry.npmjs.org/pelias-api
+ pelias-api@1.2.0 |
try/catch for the issue causing pelias/pelias#84
updates dependency which should prevent the above try/catch from firing, issue should now be resolved.
ref: caseycesari/GeoJSON.js#12
resolves #84