Fix wrong DuniterError exception handling in wot.identity_of
In silkaj.wot.identity_of
, e
is given as a parameter to DuniterError()
which in turn raises a TypeError
exception.
This issue is blocking the completion of #300 (closed) and could be fixed by deleting these two lines altogether.
silkaj/silkaj [300_balance_display_uid●] » poetry run silkaj -p gtest.jytou.fr balance BFb5yv8z1fowR6Z8mBXTALy5z7gHfMU976WtXhmRsUMh
Traceback (most recent call last):
File "/home/atrax/Temporary/20201109_silkaj/silkaj/silkaj/wot.py", line 248, in identity_of
return await client(wot.identity_of, pubkey_uid)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/duniterpy/api/bma/wot.py", line 355, in identity_of
return await client.get(
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/duniterpy/api/client.py", line 428, in get
response = await client.requests_get(url_path, **params)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/duniterpy/api/client.py", line 265, in requests_get
raise DuniterError(error_data)
duniterpy.api.errors.DuniterError: Error code 2004 - No member matching this pubkey or uid
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/atrax/Temporary/20201109_silkaj/silkaj/silkaj/tools.py", line 53, in wrapper
return loop.run_until_complete(f(*args, **kwargs))
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/atrax/Temporary/20201109_silkaj/silkaj/silkaj/money.py", line 71, in cmd_amount
uid = (await identity_of(pubkey))["uid"]
File "/home/atrax/Temporary/20201109_silkaj/silkaj/silkaj/wot.py", line 250, in identity_of
raise DuniterError(e)
File "/home/atrax/.cache/pypoetry/virtualenvs/silkaj-sNbSk8v7-py3.9/lib/python3.9/site-packages/duniterpy/api/errors.py", line 30, in __init__
super().__init__("Error code {0} - {1}".format(data["ucode"], data["message"]))
TypeError: 'DuniterError' object is not subscriptable
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f57275ad6d0>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f572754d4c0>, 28159.495414517)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f57275ad730>
Edited by Moul