winterbird-code/adbb

Handeling not valid AniDb Object

Closed this issue · 3 comments

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

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 :)

A very late update, but I think this is fixed with commit 17eb578. 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.