Twitch-Python icon indicating copy to clipboard operation
Twitch-Python copied to clipboard

IRC login error handling

Open HoodyH opened this issue 4 years ago • 2 comments

hi, it would be cool if you rise an error when there is an auth failure.

on the irc.py line 36

logging.fatal('IRC authentication error: ' + text or '')
#return
raise Exception('authentication error') 

even better if you create an exceptions.py file:

class AuthenticationError(Exception)
    pass
logging.fatal('IRC authentication error: ' + text or '')
raise AuthenticationError

So we can handle it, renewing the token or skipping the login. In my case im trying to handle multiple bots so its usefull

ty

HoodyH avatar Feb 19 '21 19:02 HoodyH

+1 This would be super useful indeed, in order to catch error and create renewal process. Out of curiosity, @HoodyH did you find a way to catch the error without modifying the lib ? thx

RduMarais avatar Dec 21 '22 19:12 RduMarais

Had a look into it, and the fix you proposed seems trivial but actually doesn't work because the library is threaded, so the exception is raised in the context of a child thread, but cannot be caught in the main thread. I look forward into it, but i'd be happy to get any insight on another (more pythonic) way to catch this

RduMarais avatar Dec 22 '22 10:12 RduMarais