winterbird-code / adbb

Object Oriented UDP Client Library for AniDB
GNU General Public License v3.0
17 stars 4 forks source link

Handeling not valid AniDb Object #9

Closed bigretromike closed 1 year ago

bigretromike commented 7 years ago

Inside animeobjs.py you raise IllegalAnimeObject("{} is not a valid AniDB object".format(self)) How do you catch this exception from main application if this is inside Thread

try:
    adbb.File(path=path)
except adbb.errors.IllegalAnimeObject:
    print("catched")

Don't work

winterbird-code commented 4 years ago

Sorry for the late reply.

This is a mistake in the design ("design" is a pretty generous word considering I just hacked this together as a learning-exercise).

The entire api-communication part basically needs to be overhauled. There are quite a few edge cases where it hangs, and you can't catch exceptions from it. I might look into it if I'm bored at some point, but unfortunately it works well-enough-for-me(tm) so my motivation is quite slim. PR:s are welcome though if anyone feels up to it :)

winterbird-code commented 1 year ago

A very late update, but I think this is fixed with commit 17eb5781446df0e9d99f72778a8f898f7e2ca921. Now the exception is triggered when trying to access an attribute on a illegal object instead of in the thread updating the object from the API.

bigretromike commented 11 months ago

@winterbird-code thank you