changeset 26:cdbc77880565

try/catch around updateToken
author Mathias Gebbe <mgebbe@intevation.de>
date Tue, 24 Jun 2014 08:32:51 +0200
parents 723eaf36902c
children f27ddfa42e94
files src/google.coffee
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/google.coffee	Mon Jun 23 10:56:29 2014 +0200
+++ b/src/google.coffee	Tue Jun 24 08:32:51 2014 +0200
@@ -253,7 +253,13 @@
   return
 
 updateToken = (user, callback) ->
-  token = user.oauth_token.substr(0,user.oauth_token.indexOf(';'))
+  try
+    if user.oauth_token.indexOf(';') isnt -1
+      token = user.oauth_token.substr(0,user.oauth_token.indexOf(';'))
+    else
+      token = user.oauth_token
+  catch err
+    console.log 'Google updateToken error' + err
   extra = user.extra_token
   data = ""
   post_data = querystring.stringify(
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)