Merge pull request #277 from knocte/friendlerAuthTestFailures

Friendlier exceptions for Auth testing
This commit is contained in:
Ilya Pirozhenko 2016-10-31 11:12:36 +03:00 committed by GitHub
commit 24a9ea1ed9
4 changed files with 32 additions and 2 deletions

View file

@ -293,6 +293,10 @@ namespace TLSharp.Core.Network
var dcIdx = int.Parse(resultString);
throw new UserMigrationException(dcIdx);
}
else if (errorMessage == "PHONE_CODE_INVALID")
{
throw new InvalidPhoneCodeException("The numeric code used to authenticate does not match the numeric code sent by SMS/Telegram");
}
else
{
throw new InvalidOperationException(errorMessage);

View file

@ -310,4 +310,9 @@ namespace TLSharp.Core
{
}
}
public class InvalidPhoneCodeException : Exception
{
internal InvalidPhoneCodeException(string msg) : base(msg) { }
}
}