GeoTIFF / geoblaze

Blazing Fast JavaScript Raster Processing Engine
http://geoblaze.io
MIT License
181 stars 28 forks source link

Remove console.error from geoblaze #190

Open chrispahm opened 2 years ago

chrispahm commented 2 years ago

First of all: Thanks for this awesome library! 🚀 🔥

Describe the bug Before throwing an error, geoblaze currently also logs the error to the console using console.error (see here for an example https://github.com/GeoTIFF/geoblaze/blob/f99483b7446eadbaf55c5371294353451e020ec3/src/stats/stats.core.js#L67.

Especially when working with large datasets, the excessive logging becomes a serious performance hit (see https://stackoverflow.com/a/26754011/6213343), and there is no option to turn it off.

To Reproduce See the following Observable notebook: https://observablehq.com/@chrispahm/geoblaze-unsupported-geometry-type When opening the console, a log of the error can be found.

Expected behavior IMHO logging should only happen on the user side. Instead of relying on geoblaze to log to the console, I think the library should just throw the error so users can decide how to proceed.

Another approach could be to pass a debug option to the geoblaze function that enables logging.

P.S.: I can create a PR if desired!