Closed bigmonkeyboy closed 9 years ago
Hey man,
Thats a good point, I've been thinking for a while about replacing the callbacks with promises and if we ever do that it will be quite easy to return the errors to the user instead of throwing an exception.
You're welcome to send any PR's, if not I will fix this after the holidays :santa:
This got implemented with 1ce84f71063774d772ece7afc4ebbaf66f72c4c0
eg:
var w3w = new What3Words(API_KEY);
w3w.wordsToPosition({ words: 'prom.cape.pump' })
.then(function(res) {
console.log(res);
})
.catch(function(err) {
console.log(err);
});
Excellent, any chance you can bump your version no in package.json and re-publish to npm ? many thanks for the quick fix.
Ahg, I knew I forgot to do something! Just published it, happy new year man :tada:
Perfect - and all the best for a Happy New Year to you also !
Currently any errors in the API cause exceptions - rather than being passed back up to the calling app using callbacks - eg see http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/ Any chance this lib can be changed to do that ?