mapbox / tilesets-cli

CLI for interacting with the Mapbox Tilesets API and Mapbox Tiling Service
https://docs.mapbox.com/mapbox-tiling-service
BSD 2-Clause "Simplified" License
125 stars 27 forks source link

Beautify Errors #177

Closed branyip closed 1 year ago

branyip commented 1 year ago

Context

This work removes confusing stack traces from error outputs.

Tests

Some before/after spot tests


Before: estimate-area, invalid geojson

image

After: estimate-area, invalid geojson

image


Before: estimate-area, json schema validation error

image

After: estimate-area, json schema validation error

image


Before: no token

image

After: no token

image


Before: delete, tileset not found

image

After: delete, tileset not found

image

branyip commented 1 year ago

@mapsam Sounds good! Will get some input from the team to confirm if we want to go forward with the patch versioning.

I tried to make the least invasive change by just swapping the Exception base class, so functionality should be unchanged. I don't think the stack traces are necessary as long as our error messages are sufficient (which they seem to be from my spot tests).

mapsam commented 1 year ago

I tried to make the least invasive change by just swapping the Exception base class, so functionality should be unchanged. I don't think the stack traces are necessary as long as our error messages are sufficient (which they seem to be from my spot tests).

👍 agree, and since the error messages aren't changing, if someone is relying on the raw text of an exception it's almost certainly the message text and not the stack trace. Let's move forward with a patch release!