mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Rename MigrationNeededException to PhoneMigrationException
There are different kind of MIGRATE errors that could be
thrown by the Telegram API, as evidenced by this recent
change:
b06f8a8e11
So this rename tries to make it consistent to the new
exception names:
* FILE_MIGRATE_x -> FileMigrationException
* USER_MIGRATE_y -> UserMigrationException
* PHONE_MIGRATE_z -> PhoneMigrationException
This commit is contained in:
parent
8c0ce7ac39
commit
c1305ada65
|
|
@ -279,7 +279,7 @@ namespace TLSharp.Core.Network
|
|||
{
|
||||
var resultString = Regex.Match(errorMessage, @"\d+").Value;
|
||||
var dcIdx = int.Parse(resultString);
|
||||
throw new MigrationNeededException(dcIdx);
|
||||
throw new PhoneMigrationException(dcIdx);
|
||||
}
|
||||
else if (errorMessage.StartsWith("FILE_MIGRATE_"))
|
||||
{
|
||||
|
|
@ -495,11 +495,11 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
}
|
||||
|
||||
internal class MigrationNeededException : Exception
|
||||
internal class PhoneMigrationException : Exception
|
||||
{
|
||||
internal int DC { get; private set; }
|
||||
|
||||
internal MigrationNeededException(int dc)
|
||||
internal PhoneMigrationException(int dc)
|
||||
: base ($"Your phone number is registered to a different DC: {dc}. Please migrate.")
|
||||
{
|
||||
DC = dc;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ namespace TLSharp.Core
|
|||
|
||||
completed = true;
|
||||
}
|
||||
catch (MigrationNeededException ex)
|
||||
catch (PhoneMigrationException ex)
|
||||
{
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue