aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorEvan Siroky <evan.siroky@yahoo.com>2017-05-29 14:53:52 -0700
committerEvan Siroky <evan.siroky@yahoo.com>2017-05-29 14:53:52 -0700
commit081c8e4bdb32132f37e09914d983ed651ade3c1c (patch)
tree5fc43cef23cb9cfe430a785539dbb210ba8d71cb /index.js
parentde3fb2bf091c13a0dae3e0621276f29c6796bca1 (diff)
downloadtimezone-boundary-builder-081c8e4bdb32132f37e09914d983ed651ade3c1c.tar.gz
Add some more debugging tools
- better naming of jsts exception output files - linting of json files
Diffstat (limited to 'index.js')
-rw-r--r--index.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/index.js b/index.js
index 23fb26a..5d61aa5 100644
--- a/index.js
+++ b/index.js
@@ -174,7 +174,7 @@ var downloadOsmBoundary = function (boundaryId, boundaryCallback) {
var curGeom = geoJsonToGeom(curOsmGeom)
} catch (e) {
console.error('error converting overpass result to geojson')
- fs.writeFileSync(boundaryId + '_fixed.json', JSON.stringify(data))
+ fs.writeFileSync(boundaryId + '_convert_to_geom_error.json', JSON.stringify(data))
throw e
}
if (!combined) {
@@ -184,7 +184,13 @@ var downloadOsmBoundary = function (boundaryId, boundaryCallback) {
}
}
}
- fs.writeFile(boundaryFilename, geomToGeoJsonString(combined), cb)
+ try {
+ fs.writeFile(boundaryFilename, geomToGeoJsonString(combined), cb)
+ } catch (e) {
+ console.error('error writing combined border to geojson')
+ fs.writeFileSync(boundaryId + '_combined_border_convert_to_geom_error.json', JSON.stringify(data))
+ throw e
+ }
}]
}, boundaryCallback)
}