mapbox / tippecanoe

Build vector tilesets from large collections of GeoJSON features.
BSD 2-Clause "Simplified" License
2.71k stars 429 forks source link

Tippecanoe exit codes #686

Open joto opened 5 years ago

joto commented 5 years ago

As far as I can see tippecanoe only has one exit code (EXIT_FAILURE) for all error conditions. This makes it difficult to differentiate between different types of errors in scripts. This came up for me when tippecanoe didn't find any geometries in the input and exited with "Did not read any valid geometries". In my use case this isn't an error at all, I would expect to just get empty vector tiles then. But at the very least I want to be able to check for this.

I suggest using different exit codes for different severities. This is the model I have been moving towards for a while:

There might be several of the "Exit code 1" cases. So maybe more exit codes needed.

e-n-f commented 5 years ago

Good idea!

marc-guenther commented 3 years ago

It's even worse, I get an exit code 0, even though tippecanoe detected an error. I had an error im my Download-From-S3 function, which resulted in feeding it incomplete files.

Here is an example call:

~/tippe$ tippecanoe -f -o test.mbtiles example-broken.geojson;echo "Exit code: $?"
For layer 0, using name "examplebroken"
example-broken.geojson:1693: String without closing quote mark
In JSON object {"features":[{"geometry":{"coordinates":[22.5,45.0],"type":"Point"},"type":"Feature","properties":{"WindSpeed":13.29280057394667}}]}
120 features, 2493 bytes of geometry, 4 bytes of separate metadata, 4688 bytes of string pool
  99.9%  14/9216/5556   
Exit code: 0

This of course also results in incomplete mbtiles file.

I would like to detect this error. As exit code doesn't work, I thought I can check for output present on stderr, but everything is always printed on stderr, even on a successful run, so that wouldn't work either. I guess I could use -q, but then I would loose normal output for logging.

Should I file a new issue for this?