Merge pull request #263 from knocte/improveExceptions

Always include an innerException when re-throwing
This commit is contained in:
Ilya Pirozhenko 2016-10-24 11:30:33 +03:00 committed by GitHub
commit 0a227b8412
3 changed files with 5 additions and 4 deletions

View file

@ -488,7 +488,7 @@ namespace TLSharp.Core.Network
internal int DC { get; private set; }
internal MigrationNeededException(int dc)
: base ("$Your phone number is registered to a different dc: {dc}. Please migrate.")
: base ($"Your phone number is registered to a different DC: {dc}. Please migrate.")
{
DC = dc;
}

View file

@ -49,9 +49,10 @@ namespace TLSharp.Tests
{
return new TelegramClient(ApiId, ApiHash);
}
catch (MissingApiConfigurationException)
catch (MissingApiConfigurationException ex)
{
throw new Exception($"Please add your API settings to the `app.config` file. (More info: {MissingApiConfigurationException.InfoUrl})");
throw new Exception($"Please add your API settings to the `app.config` file. (More info: {MissingApiConfigurationException.InfoUrl})",
ex);
}
}

View file

@ -21,7 +21,7 @@ namespace TeleSharp.TL
}
catch(Exception ex)
{
throw new InvalidDataException("Constructor Invalid Or Context.Init Not Called !");
throw new InvalidDataException("Constructor Invalid Or Context.Init Not Called !", ex);
}
if (t.IsSubclassOf(typeof(TLMethod)))
{