[fix] #366 : Remove TyperError-inducing call to DuniterError
Remove an unnecessary and TypeError-inducing call to DuniterError in silkaj.wot
Close #366 (closed)
Merge request reports
Activity
added Bug Web of Trust labels
added 1 commit
- 12e66a6d - [fix] #366 (closed) : Remove TyperError-inducing call to DuniterError
added 1 commit
- 8c10e624 - [fix] #366 (closed) : Handle DuniterError properly
added 1 commit
- 02359124 - [fix] #366 (closed) : Remove TypeError-inducing call
I think it is nice that errors get raised when they should. (NB: I am relatively new to coding, I have not seriously managed errors for now)
Here we have two different errors :
- DuniterError : is not a member -> I think this is useful.
- TypeError : DuniterError is not subscriptable. -> this is a bug.
For this last, we may change the code to :
try: return await client(wot.identity_of, pubkey_uid) except DuniterError as e: raise e except ValueError as e: pass
I saw you are doing this for #300 (closed), I looked at your branch
300_balance_display_uid
. I think this particular change should be part of the MR for #300 (closed).I would advise you to use is_member() instead of identity_of(). is_member() will catch the error and return False, which is more or less what you want.
I would like to know what @moul thinks about it.
I think it is nice that errors get raised when they should. (NB: I am relatively new to coding, I have not seriously managed errors for now)
That's the way to go. Your example doesn't change the core logic, but it might be valuable for other contributors working with
identity_of
while still fixing the bug.I saw you are doing this for #300 (closed), I looked at your branch 300_balance_display_uid. I think this particular change should be part of the MR for #300 (closed).
I can include it there.
I would advise you to use is_member() instead of identity_of(). is_member() will catch the error and return False, which is more or less what you want.
Gonna check that.
changed milestone to %0.9.0
Sorry for the time I needed to check this one.
@atrax, did you check whether it's not breaking any features built on top of
wot.identity_of()
?assigned to @moul
requested review from @moul
@moul Sorry I was very busy the last few weeks.
Exceptions are handled properly with each
wot.identity_of()
call, except incommand.list_blocks()
. Otherwise the except block doesn't specify any specific exception wheneverwot.identity_of()
is called, which explains why this bug wasn't an issue so far.I'm gonna wrap it up properly with a try/except block in
command.list_blocks()
. I just need to figure out what is expected in case there is no identity attached to the pubkey.added 11 commits
-
02359124...408be46d - 10 commits from branch
clients/python:dev
- b703e1af - [fix] #366 (closed) : Remove TypeError-inducing call
-
02359124...408be46d - 10 commits from branch
Since only members can issue blocks, this change doesn't affect
command.list_blocks()
. It's also caught intx_history.generate_header()
,wot.is_member()
,wot.identities_from_pubkeys()
,wot.id_pubkey_correspondence()
.It doesn't break anything in current code, yet it fixes how this exception is handled. For me it's good so far.