Add additional debugging to try and identify cause of MB#11103
[hermes] / package / src / org / maemo / hermes / engine / linkedin / api.py
index ebb0c60..363b2e9 100644 (file)
@@ -5,6 +5,7 @@ from oauth import oauth
 from xml.dom.minidom import parseString
 from org.maemo.hermes.engine.phonenumber import PhoneNumber
 from org.maemo.hermes.engine.friend import Friend
+from org.maemo.hermes.engine.service import CredentialsExpiredException
 
 class LinkedInApi():
     """LinkedIn API for Hermes.
@@ -123,13 +124,16 @@ class LinkedInApi():
         
         # look for errors
         errors = dom.getElementsByTagName('error')
-        if (errors and len(errors) > 0):
+        if errors and len(errors) > 0:
             details = ""
             try:
                 details = " (" + extract(errors[0], "message") + ")"
             except:
                 pass
-            raise Exception("LinkedIn communication errors detected" + details)
+            if details.startswith('([unauth'):
+                raise CredentialsExpiredException('linkedin')
+            else:
+                raise Exception("LinkedIn communication errors detected" + details)
         
         friends = []
         people = dom.getElementsByTagName('person')