Closed doiraduc closed 1 year ago
Hey, thanks for the report. That sounds weird to me and looks like something I've never encountered before.
I'll check it and follow up on this thread. I see that this is something from the HTTP package - ClientException is thrown when a request fails.
Btw, can you please tell me if you have attached an error handler using the Televerse.onError
method?
Hi, sorry for the late response. No, I didn't set the onError handler.
If it helps, in case I will get more errors like this I'll post them here.
No problem and thanks for the response.
Sure, more logs will surely be helpful. Also, please try attaching a error handler with Televerse.onError
method.
All of the exceptions happening around the library code or user defined handlers will be caught there. That's really sounds like your dream crash free bot. Let's see if this issue one breaks the laws of Televerse :)
Hey, just wanted to follow up on the issue. Have you seen it occurring again? If so, please let me know the details :)
Hi, for the moment, I've been working on the bot, and tomorrow, I will leave it running for at least 5 days without stopping it to see if it crashes again. I'll certainly let you know if it does or it doesn't.
Got the same issue here, happen to all my bots, no logs whatsoever, maybe trying to use dio instead could help fix the issue.
I'm pretty sure that it anything happens around long polling gets failed it will be caught on onError
handler.
So the idea of no logs is kind of a wonder to me.
@devsdocs were you using onError handler to catch unexpected errors?
yep, got nothing, my code below:
bot.onError((err, st) async { errorExist(err, st); });
void errorExist(dynamic err, dynamic st) { String? data; if (err is TelegramException) { data = 'Telegram Exception: ${err.code}\n${err.description}\n${err.parameters}\n${err.stackTrace}'; } else if (err is TeleverseException) { data = 'Televerse Exception: ${err.description}\n${err.message}\n${err.stackTrace}'; } else if (err is LongPollingException) { data = 'Longpolling Exception: ${err.code}\n${err.message}\n${err.parameters}\n${err.stackTrace}'; } else { data = 'Error: $err'; } bot.api.sendMessage(BotConfig.logChat, '$data\nStack: $st'); }
Wow that's weird. So the bot was unexpectedly stopped even without any log? If it was an uncaught exception at least the Dart process will log something...
Can you check any other possibilities for the process to be terminated?
Hey @iamcosmin @devsdocs, I've merged PR #139 and pushed #142 to release - we're now using dio
instead of http
. (Thanks @devsdocs) 🚀
Please note that there's a breaking change around Televerse.onError
handler. The handler should now accept a single BotError
instance instead of an err
and stackTrace
.
This is to also include the context inside the error which will possibly help you to auto-retry the requests (as discussed in the chat group)
Please let me know if this issue happens again... And also, feel free to share more logs if you find any.
You're Welcome @HeySreelal. I'll post if any problem occur. Thank you.
Hey, just checking in - is this still up?
On my end I haven't experienced this anymore.
Thankss for confirming. So we can close this?
I think so.
Perfect! Closing this now. Thanks again :)
After a random amount of time (hours or even days), the bot crashes. Sometimes, there's no error or message in the console, it just exits. Other times, there are errors like
Do note that in the error I included above, I hid my bot's token with < TOKENHERE >.
Usually, restarting the bot does the trick, only to crash again after another random amount of time (usually 8-10 hours or 2-5 days).