-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override Message default equalty operator #235
Conversation
Compares type, chatId and messageId
Example of error stack trace: http response json data: {ok: false, error_code: 400, description: Bad Request: message can't be deleted} Unhandled exception: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast #0 _$ErrorResponseFromJson (package:teledart/src/telegram/model.g.dart:3578:30) DinoLeung#1 new ErrorResponse.fromJson (package:teledart/src/telegram/models/response.dart:78:7) DinoLeung#2 HttpClient._parseResponse (package:teledart/src/util/http_client.dart:43:51) DinoLeung#3 _rootRunUnary (dart:async/zone.dart:1399:47) <asynchronous suspension> DinoLeung#4 Telegram.deleteMessage (package:teledart/src/telegram/telegram.dart:2346:12) <asynchronous suspension> DinoLeung#5 TelegramMessageRegister.removeMessages.<anonymous closure> (package:busslina_dart_rest_lib/core/module> <asynchronous suspension> DinoLeung#6 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16) <asynchronous suspension> DinoLeung#7 _TelegramHandler._getMenuCommandHandler (package:busslina_dart_rest_lib/core/modules/system.module.dar> <asynchronous suspension> DinoLeung#8 TelegramBot.onCommand.<anonymous closure> (package:busslina_dart_telegram_lib/src/core/app/telegram_bo> <asynchronous suspension> DinoLeung#9 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16) <asynchronous suspension> autodia-server.service: Main process exited, code=exited, status=255/EXCEPTION
(Change 2): Resolved null ErrorResponse parameters fieldExample of error stack trace: HTTP response json data:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@busslina thanks for submitting this PR, it seems that it is addressing multiple thing here. Will be closing this PR, and create a new one to address the issue which is the ResponseParameters
type error.
if (error.isTooManyRequests()) { | ||
retryDelay = error.parameters?.retryAfter_ ?? retryDelay; | ||
_onRecursivePollingError(error); | ||
} else if (error.code == 409) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
409 error is a conflict error, and it does not seem to be a retry-able error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but like in 429 error, it must be a way to catch it and not let the whole app crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR has export the http client along with the exception class 👍
@@ -52,4 +52,18 @@ class Audio { | |||
|
|||
factory Audio.fromJson(Map<String, dynamic> json) => _$AudioFromJson(json); | |||
Map<String, dynamic> toJson() => _$AudioToJson(this); | |||
|
|||
@override | |||
String toString() => '''Audio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these toString
methods for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are methods to debug that I use internally on my fork
@@ -212,4 +212,13 @@ class Message { | |||
return null; | |||
} | |||
} | |||
|
|||
@override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is cool
@@ -65,7 +65,7 @@ class ErrorResponse { | |||
bool ok; | |||
String description; | |||
int errorCode; | |||
ResponseParameters parameters; | |||
ResponseParameters? parameters; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
(Change 1): Compares type, chatId and messageId.