Skip to content

Instantly share code, notes, and snippets.

@dimotsai
Created September 19, 2016 03:22
Show Gist options
  • Select an option

  • Save dimotsai/6a0a7a61ce8e7e879b027bbd884e0a2a to your computer and use it in GitHub Desktop.

Select an option

Save dimotsai/6a0a7a61ce8e7e879b027bbd884e0a2a to your computer and use it in GitHub Desktop.
diff --git a/get_reverse_geocode.js b/get_reverse_geocode.js
index d334008..27a8e0c 100644
--- a/get_reverse_geocode.js
+++ b/get_reverse_geocode.js
@@ -9,7 +9,9 @@ module.exports = function(latitude, longitude, language = 'zh-TW') {
latlng: `${latitude},${longitude}`,
language: language
}, function(err, body) {
- if (body.status != 'OK') {
+ if (err) {
+ reject(err);
+ } else if (body.status != 'OK') {
reject(body.error_message);
} else {
let components = [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment