DenisCarriere / geocoder-geojson

Geocoding results in GeoJSON format
https://www.npmjs.com/package/geocoder-geojson
MIT License
21 stars 10 forks source link

Error function raises #6

Closed terry90 closed 7 years ago

terry90 commented 7 years ago

This function:

function error(message) {
        process.stdout.write(`[Error] ${message}\n`);
        throw new Error(message);
}

With message = "[options.access_token] is required"

Gives me:

TypeError: Cannot read property 'write' of undefined
    at Object.error (content.js:32482)
    at Object.<anonymous> (content.js:30348)
    at Generator.next (<anonymous>)
    at content.js:30309
    at __awaiter (content.js:30305)
    at Object.mapbox (content.js:30340)
    at content.js:30291

When calling:

geocoder.mapbox(address)
  .then((geojson) => cb({ ...geojson, provider: 'mapbox' }))
  .catch((err) => {
    console.log(err);
 });

cb is the callback of my function.

PS: Not urgent for me since I can see the message in chrome debugger.

DenisCarriere commented 7 years ago

@terry90 That error shouldn't be happening anymore, I was using process.stdout to output the error, but the browsers don't have process so I changed it to console.log instead.

I've bumped the npm and pushed a commit, test it now and let me know if it works out.

cheers,