From e1ff4bb75b8d418d0c65fd165542b5bd452becad Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Sun, 30 Oct 2016 16:16:55 +0800 Subject: [PATCH] Bring back report message to Migration exceptions When refactoring recently the PHONE_MIGRATE_X error wrt exception handling [1] I removed the dubious/obsolete "settings" part, but I mistakenly removed the URL which tells library consumers that if they face this exception, it's actually a bug of the library that they should report. [1] https://github.com/sochix/TLSharp/commit/77867b44e626aedfba58cf9729100e3cc1a808a8 --- README.md | 4 ++-- TLSharp.Core/Network/MtProtoSender.cs | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bdde200..301a0a2 100644 --- a/README.md +++ b/README.md @@ -203,9 +203,9 @@ Contributing is highly appreciated! #### What API layer is supported? The latest one - 57. Thanks to Afshin Arani for his TLGenerator -#### I get an error MIGRATE_X? +#### I get a xxxMigrationException or a MIGRATE_X error! -TLSharp library should automatically handle this errors. If you see such errors, pls create a new issue. +TLSharp library should automatically handle these errors. If you see such errors, please open a new Github issue with the details (include a stacktrace, etc.). #### I get an exception: System.IO.EndOfStreamException: Unable to read beyond the end of the stream. All test methos except that AuthenticationWorks and TestConnection return same error. I did every thing including setting api id and hash, and setting server address.- diff --git a/TLSharp.Core/Network/MtProtoSender.cs b/TLSharp.Core/Network/MtProtoSender.cs index 6966028..cadaad4 100644 --- a/TLSharp.Core/Network/MtProtoSender.cs +++ b/TLSharp.Core/Network/MtProtoSender.cs @@ -499,7 +499,10 @@ namespace TLSharp.Core.Network { internal int DC { get; private set; } - protected DataCenterMigrationException(string msg, int dc) : base (msg) + private const string REPORT_MESSAGE = + " See: https://github.com/sochix/TLSharp#i-get-an-error-migrate_x"; + + protected DataCenterMigrationException(string msg, int dc) : base (msg + REPORT_MESSAGE) { DC = dc; } @@ -508,7 +511,7 @@ namespace TLSharp.Core.Network internal class PhoneMigrationException : DataCenterMigrationException { internal PhoneMigrationException(int dc) - : base ($"Your phone number is registered to a different DC: {dc}. Please migrate.", dc) + : base ($"Phone number registered to a different DC: {dc}.", dc) { } } @@ -516,7 +519,7 @@ namespace TLSharp.Core.Network internal class FileMigrationException : DataCenterMigrationException { internal FileMigrationException(int dc) - : base ($"File is located on a different DC: {dc}. Please migrate.", dc) + : base ($"File located on a different DC: {dc}.", dc) { } } @@ -524,7 +527,7 @@ namespace TLSharp.Core.Network internal class UserMigrationException : DataCenterMigrationException { internal UserMigrationException(int dc) - : base($"User is located on a different DC: {dc}. Please migrate.", dc) + : base($"User located on a different DC: {dc}.", dc) { } }