To make this module compatible with other fluent modules such as "seq", the first argument of the callback needs to be the error status. And this would be used instead of throwing an Error.
My current code:
Seq()
.seq(function() {
// Geocode request
var _this=this;
try {
Geo.geocoder(Geo.google, vevent.location, sensor, function(formattedAddress, latitude, longitude, details) {
console.log('geocode results', formattedAddress, latitude, longitude, details);
_this(null);
});
} catch (error) {
console.log('Geocode failed', error);
_this(error);
}
})
;
Should become:
Seq()
// make geocode request
.seq(function() {
Geo.geocoder(Geo.google, vevent.location, sensor, this);
})
// process geocode response
.seq(function(formattedAddress, latitude, longitude, details) {
console.log('geocode results', formattedAddress, latitude, longitude, details);
})
// process geocode failure
.catch(function(error) {
console.log('Geocode failed', error);
})
;
To make this module compatible with other fluent modules such as "seq", the first argument of the callback needs to be the error status. And this would be used instead of throwing an Error.
My current code:
Should become: