{"action":"created","issue":{"url":"https://api.github.com/repos/crossbario/autobahn-python/issues/539","labels_url":"https://api.github.com/repos/crossbario/autobahn-python/issues/539/labels{/name}","comments_url":"https://api.github.com/repos/crossbario/autobahn-python/issues/539/comments","events_url":"https://api.github.com/repos/crossbario/autobahn-python/issues/539/events","html_url":"https://github.com/crossbario/autobahn-python/issues/539","id":114467519,"number":539,"title":"Error happens when callee raise an empty Exception","user":{"login":"tangyouze","id":815306,"avatar_url":"https://avatars.githubusercontent.com/u/815306?v=3","gravatar_id":"","url":"https://api.github.com/users/tangyouze","html_url":"https://github.com/tangyouze","followers_url":"https://api.github.com/users/tangyouze/followers","following_url":"https://api.github.com/users/tangyouze/following{/other_user}","gists_url":"https://api.github.com/users/tangyouze/gists{/gist_id}","starred_url":"https://api.github.com/users/tangyouze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangyouze/subscriptions","organizations_url":"https://api.github.com/users/tangyouze/orgs","repos_url":"https://api.github.com/users/tangyouze/repos","events_url":"https://api.github.com/users/tangyouze/events{/privacy}","received_events_url":"https://api.github.com/users/tangyouze/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-01T12:36:28Z","updated_at":"2015-11-11T14:26:35Z","closed_at":"2015-11-11T14:26:35Z","body":"If callee raise Exception() or an raise ApplicationError('com.crossbardemo') without args, there would be an error in protocol.py during handle the error.\r\n\r\nThe error may come with line 850 in protocol.py\r\n```\r\n                            errmsg = \"{0}\".format(err.value.args[0])\r\n```\r\nas err.value.args is an empty list\r\n\r\nHere's the code\r\n\r\n```\r\ntry:\r\n    import asyncio\r\nexcept ImportError:\r\n    # Trollius >= 0.3 was renamed\r\n    import trollius as asyncio\r\n\r\nfrom autobahn import wamp\r\nfrom autobahn.wamp.exception import ApplicationError\r\nfrom autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner\r\n\r\n\r\n\r\n\r\nclass Component(ApplicationSession):\r\n    \"\"\"\r\n    Example WAMP application backend that raised exceptions.\r\n    \"\"\"\r\n\r\n    @asyncio.coroutine\r\n    def onJoin(self, details):\r\n\r\n        def sqrt():\r\n            # raise empty exception\r\n            raise Exception()\r\n\r\n        yield from self.register(sqrt, u'com.myapp.sqrt')\r\n\r\n        try:\r\n            yield from self.call('com.myapp.sqrt')\r\n        except:\r\n            print('exception catch')\r\n\r\n\r\nif __name__ == '__main__':\r\n    runner = ApplicationRunner(\r\n        u\"ws://f1:8080/ws\",\r\n        u\"crossbardemo\",\r\n        debug_wamp=False,  # optional; log many WAMP details\r\n        debug=False,  # optional; log even more details\r\n    )\r\n    runner.run(Component)\r\n\r\n```\r\n\r\nand will come up with\r\n\r\n```\r\nC:\\Anaconda3\\python.exe D:/Dropbox/code/quantlib/learn/error_exception.py\r\nException in callback add_callbacks.<locals>.done(<Future finis...n=Exception()>) at C:\\Anaconda3\\lib\\site-packages\\txaio\\aio.py:336\r\nhandle: <Handle add_callbacks.<locals>.done(<Future finis...n=Exception()>) at C:\\Anaconda3\\lib\\site-packages\\txaio\\aio.py:336>\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\txaio\\aio.py\", line 338, in done\r\n    res = f.result()\r\n  File \"C:\\Anaconda3\\lib\\asyncio\\futures.py\", line 275, in result\r\n    raise self._exception\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\txaio\\aio.py\", line 278, in as_future\r\n    res = fun(*args, **kwargs)\r\n  File \"D:/Dropbox/code/quantlib/learn/error_exception.py\", line 24, in sqrt\r\n    raise Exception()\r\nException\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda3\\lib\\asyncio\\events.py\", line 120, in _run\r\n    self._callback(*self._args)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\txaio\\aio.py\", line 345, in done\r\n    errback(create_failure())\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\autobahn\\wamp\\protocol.py\", line 805, in error\r\n    errmsg = \"{0}\".format(err.value.args[0])\r\nIndexError: tuple index out of range\r\n\r\nProcess finished with exit code -1\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/crossbario/autobahn-python/issues/comments/155796681","html_url":"https://github.com/crossbario/autobahn-python/issues/539#issuecomment-155796681","issue_url":"https://api.github.com/repos/crossbario/autobahn-python/issues/539","id":155796681,"user":{"login":"oberstet","id":233340,"avatar_url":"https://avatars.githubusercontent.com/u/233340?v=3","gravatar_id":"","url":"https://api.github.com/users/oberstet","html_url":"https://github.com/oberstet","followers_url":"https://api.github.com/users/oberstet/followers","following_url":"https://api.github.com/users/oberstet/following{/other_user}","gists_url":"https://api.github.com/users/oberstet/gists{/gist_id}","starred_url":"https://api.github.com/users/oberstet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oberstet/subscriptions","organizations_url":"https://api.github.com/users/oberstet/orgs","repos_url":"https://api.github.com/users/oberstet/repos","events_url":"https://api.github.com/users/oberstet/events{/privacy}","received_events_url":"https://api.github.com/users/oberstet/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T14:26:35Z","updated_at":"2015-11-11T14:26:35Z","body":"duplicate of #484"}}