xooniverse / televerse

Your gateway to seamless Telegram Bot Development 💙
https://televerse.xooniverse.com
BSD 3-Clause "New" or "Revised" License
64 stars 11 forks source link

Random DioExceptions #143

Closed doiraduc closed 1 year ago

doiraduc commented 1 year ago

Since switching to dio, I started getting these weird errors

DioException [bad response]: The request returned an invalid status code of 400.
#0      DioMixin.fetch.<anonymous closure> (package:dio/src/dio_mixin.dart:507:7)
#1      _RootZone.runUnary (dart:async/zone.dart:1661:54)
#2      _FutureListener.handleError (dart:async/future_impl.dart:165:22)
#3      Future._propagateToListeners.handleError (dart:async/future_impl.dart:796:47)
#4      Future._propagateToListeners (dart:async/future_impl.dart:817:13)
#5      Future._completeError (dart:async/future_impl.dart:592:5)
#6      _SyncCompleter._completeError (dart:async/future_impl.dart:51:12)
#7      _Completer.completeError (dart:async/future_impl.dart:23:5)
#8      Future.any.onError (dart:async/future.dart:620:45)
#9      _RootZone.runBinary (dart:async/zone.dart:1666:54)
#10     _FutureListener.handleError (dart:async/future_impl.dart:162:22)
#11     Future._propagateToListeners.handleError (dart:async/future_impl.dart:796:47)
#12     Future._propagateToListeners (dart:async/future_impl.dart:817:13)
#13     Future._completeError (dart:async/future_impl.dart:592:5)
#14     Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:683:7)
#15     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#17     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:123:13)
#18     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:405:11)
#19     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#20     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)

For the moment, I experimented these errors sometimes (but not everytime) I called ctx.getChatMember.

doiraduc commented 1 year ago

Seems like it is not an issue with dio. I downgraded to a previous version of televerse and I'm getting this error

Unhandled exception:
TelegramException [400]: (Bad Request: can't parse entities: Unsupported start tag "string" at byte offset 37)

#0      HttpClient.postURI (package:televerse/src/utils/http.dart:32:7)
<asynchronous suspension>
#1      RawAPI.sendMessage (package:televerse/src/televerse/raw_api.dart:247:37)
<asynchronous suspension>
#2      MessageMixin.reply (package:televerse/src/televerse/context/mixins/message_mixin.dart:31:12)
<asynchronous suspension>

When trying to call getChatMember.

HeySreelal commented 1 year ago

Heyy, thanks for raising this. I'll check it later today.

doiraduc commented 1 year ago

Hey! Sorry for the hassle, I found out that the problem is actually from my code. I was parsing some weird HTML.

But, I have to admit, it would've been so much easier if the exception details were written instead of just DioException, just like in the previous versions. Is this something possible to do?

HeySreelal commented 1 year ago

Hey @iamcosmin, just pushed v1.10.9 to release. Hopefully, this will throw more meaningful exceptions than the random DioExceptions.

HeySreelal commented 1 year ago

Closing this issue for now, feel free to reopen it if the issue persists.