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:
Andres G. Aragoneses 2016-10-30 15:57:45 +08:00
parent 8c0ce7ac39
commit c1305ada65
2 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -124,7 +124,7 @@ namespace TLSharp.Core
completed = true;
}
catch (MigrationNeededException ex)
catch (PhoneMigrationException ex)
{
await ReconnectToDcAsync(ex.DC);
}