Remove superfluous error messages and handle uncaught exceptions

This commit is contained in:
moyamo 2016-01-02 22:40:11 +02:00
parent ef04f49152
commit ee743ac327
3 changed files with 12 additions and 5 deletions

View file

@ -262,7 +262,6 @@ class SpectrumBackend:
def handleConvMessagePayload(self, data):
payload = protocol_pb2.ConversationMessage()
self.logger.error("handleConvMessagePayload")
if (payload.ParseFromString(data) == False):
#TODO: ERROR
return

View file

@ -434,10 +434,12 @@ class Session(YowsupApp):
def onPresenceReceived(self, _type, name, jid, lastseen):
self.logger.info("Presence received: %s %s %s %s", _type, name, jid, lastseen)
buddy = jid.split("@")[0]
try:
buddy = self.buddies[buddy]
try:
buddy = self.buddies[buddy]
except KeyError:
self.logger.error("Buddy not found: %s", buddy)
# Sometimes whatsapp send our own presence
if buddy != self.legacyName:
self.logger.error("Buddy not found: %s", buddy)
return
if (lastseen == str(buddy.lastseen)) and (_type == buddy.presence):

View file

@ -62,7 +62,13 @@ logging.basicConfig( \
# Handler
def handleTransportData(data):
plugin.handleDataRead(data)
try:
plugin.handleDataRead(data)
except SystemExit as e:
raise e
except:
logger = logging.getLogger('transwhat')
logger.error(traceback.format_exc())
e4u.load()