Commit graph

269 commits

Author SHA1 Message Date
Andres G. Aragoneses 738a84937e SendMessageTest: rather crash with meaningful exception
Rather crash with meaningful exception than not passing the
test and only giving a hint when debugging.
2016-11-03 01:31:47 +08:00
Ilya Pirozhenko 8b04f82846 Merge pull request #283 from knocte/throwInsteadOfSleep
Throw FloodException instead of calling Thread.Sleep()
2016-11-01 21:05:14 +03:00
Andres G. Aragoneses 5e9bb6163f Throw FloodException instead of calling Thread.Sleep()
Doing this is better when looking at the problem from at least
these 2 points of view:

a) You're working on TLSharp itself: You might be testing some
new things or running TLSharp's tests. Suddenly, if a FLOOD_WAIT
response happens, there's no clear way to know. You just see the
tests taking forever. But if a test has reached a situation in
which Telegram has returned a FLOOD_WAIT error, it's very likely
that what happens is that the TLSharp operation being tested is
actually buggy, which means that the test should FAIL FAST and
show a stacktrace of the problem so that you can see where in the
code was the FLOOD_WAIT received/caused. You shouldn't need to
kill the run of the test suite and hope to hit the problem again
only when you were using the debugger (to be able to pause
execution and examine a stacktrace of where the execution flow is).

b) You're using TLSharp: if you hit a FLOOD_WAIT problem it may
happen because:

b1) TLSharp has a bug: in this case it's better to throw an
exception so that the user can copy the stacktrace and paste
it into a new Github issue.

b2) Your program uses TLSharp sending excessive requests: you
want to have your program know when you hit the limit, to be
able to fix your program to not be so floody. But a call to
Thread.Sleep() doesn't help you to know this, you just know
that suddenly your program has hung, and you don't know why.
You cannot react to the problem, however with an exception you
can react to the problem (for example by examining the time
that the exception provides, as a TimeSpan property, to know
how much your program needs to wait to be able to use TLSharp
again).
2016-11-01 23:52:58 +08:00
Ilya Pirozhenko d8fca8619c Merge pull request #281 from knocte/fixTypo
Fix typo "CpdeToAuthenticate" -> CodeToAuthenticate
2016-11-01 08:53:57 +03:00
Andres G. Aragoneses 9986270bed Fix typo "CpdeToAuthenticate" -> CodeToAuthenticate
And let's use nameof() in all cases so this doesn't happen again.
2016-11-01 01:33:26 +08:00
Ilya Pirozhenko 24a9ea1ed9 Merge pull request #277 from knocte/friendlerAuthTestFailures
Friendlier exceptions for Auth testing
2016-10-31 11:12:36 +03:00
Ilya Pirozhenko 054bbe88f3 Update README.md 2016-10-31 09:08:38 +03:00
Ilya Pirozhenko ce193ff79d Merge pull request #279 from timocov/master
Fix TLVector serialization with TLObject
2016-10-31 09:07:40 +03:00
Ilya Pirozhenko 9108cca961 Merge pull request #276 from knocte/precondExceptions
Require some parameters as non empty & not null before proceeding
2016-10-31 09:04:17 +03:00
Eugene Timokhov a0cdc2ae1a Fix TLVector serialization with TLObject 2016-10-30 20:26:17 +03:00
Andres G. Aragoneses f062c0a7a1 Friendlier exceptions for Auth testing
This change also lets you write the auth code in the
app.config file without the need to recompile/debug.
2016-10-31 00:17:03 +08:00
Andres G. Aragoneses 34e89f3f37 Require some parameters as non empty & not null before proceeding 2016-10-30 23:34:44 +08:00
Andres G. Aragoneses a029c33e34 TelegramClient ctor: move null checks earlier
This way we avoid creating a FileSessionStore object
or initializing the TLContext if API credentials are
not supplied, to be on the safe side.
2016-10-30 23:34:33 +08:00
Ilya Pirozhenko b0b58be25e Merge pull request #272 from knocte/reworkMigrateExceptions
Rework MIGRATE errors/exceptions
2016-10-30 11:51:30 +03:00
Andres G. Aragoneses 5161d38456 MigrationExceptions: update URL
Previous commit[1] made the anchor change its name due to
changing slightly the content of the README around the
MIGRATE problem.

[1] e1ff4bb75b
2016-10-30 16:33:29 +08:00
Andres G. Aragoneses e1ff4bb75b 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] 77867b44e6
2016-10-30 16:16:55 +08:00
Andres G. Aragoneses a521466bb0 Create common abstract DataCenterMigrationException
We can abstract the DC property to a common abstract class
so have a bit of less code and we join these 3 classes together
semantically.
2016-10-30 16:04:32 +08:00
Andres G. Aragoneses c1305ada65 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
2016-10-30 15:57:45 +08:00
Ilya Pirozhenko 8c0ce7ac39 Update README.md 2016-10-29 17:31:08 +03:00
Ilya P d692196dce another fix 2016-10-29 17:13:28 +03:00
Ilya P 58d83cfcfe Path fix 2016-10-29 17:05:40 +03:00
Ilya P 46694e2406 Moved nuspec to a proper place 2016-10-29 15:34:01 +03:00
Ilya P d6ecbd6653 Update nuspec 2016-10-29 15:29:03 +03:00
Ilya P 87091b59bd Merge branch 'master' of https://github.com/sochix/TLSharp 2016-10-29 15:02:22 +03:00
Ilya P f1ea21c5b6 Added nuspec 2016-10-29 15:02:00 +03:00
Ilya Pirozhenko 0d07813299 Update README.md 2016-10-29 11:48:22 +03:00
Ilya P b06f8a8e11 Added File-Migrate feature 2016-10-29 11:47:18 +03:00
Ilya P df66bfb6e3 bug-fix 2016-10-29 09:53:45 +03:00
Ilya Pirozhenko 263685f050 Merge pull request #269 from aarani/patch-1
Change TLDialogs to TLAbsDialogs
2016-10-28 09:30:22 +03:00
Afshin Arani 63fc19dded Merge pull request #3 from aarani/patch-2
Update TLSharpTests.cs
2016-10-26 20:16:15 +03:30
Afshin Arani bc24dbfd65 Update TLSharpTests.cs 2016-10-26 20:15:33 +03:30
Afshin Arani 8c2cab48f4 Change TLDialogs to TLAbsDialogs 2016-10-26 20:13:19 +03:30
Afshin Arani 49bce93523 Merge pull request #2 from sochix/master
Sochix Works
2016-10-26 20:08:55 +03:30
Ilya Pirozhenko 0a227b8412 Merge pull request #263 from knocte/improveExceptions
Always include an innerException when re-throwing
2016-10-24 11:30:33 +03:00
Andres G. Aragoneses 3639ae3e88 Always include an innerException when re-throwing
Hiding the previous thrown exception is a bad practice.
2016-10-24 14:58:04 +08:00
Andres G. Aragoneses c644bac4e4 Fix typo in string of exception message
This was meant to start with $, not including
the $ char inside the string, otherwise the
compiler string interpolation doesn't work.
2016-10-24 14:57:04 +08:00
Ilya Pirozhenko 209ab1454f Merge pull request #260 from knocte/betterFirstException4Tests
Tests: show a more meaningful exception when running for 1st time
2016-10-24 09:35:36 +03:00
Andres G. Aragoneses 0e32291d11 Tests: show a more meaningful exception when running for 1st time
Instead of throwing a System.FormatException, capture the URL
thrown by the library itself so that the developer configures
the API_ID and API_HASH and places them in the app.config file.
2016-10-23 23:23:10 +08:00
Ilya P 96c63b3f66 Merge branch 'master' of https://github.com/sochix/TLSharp 2016-10-23 14:12:56 +03:00
Ilya P b823c34078 Move upload helper to helpers 2016-10-23 14:12:34 +03:00
Ilya P 6d106b4425 Merge fix 2016-10-23 14:10:54 +03:00
Ilya P a53800ba16 Merge remote-tracking branch 'refs/remotes/origin/master' into pr/258
# Conflicts:
#	TLSharp.Tests/TLSharpTests.cs
2016-10-23 14:09:16 +03:00
Ilya Pirozhenko 4046109761 Merge pull request #259 from knocte/avoidNRE
Tests: avoid NullReferenceException
2016-10-23 14:05:59 +03:00
Ilya Pirozhenko b7f3da1756 Update README.md 2016-10-23 13:46:28 +03:00
Andres G. Aragoneses 1719fd9f19 Tests: avoid NullReferenceException
Instead of throwing cryptic NullReferenceException
when this test fails, let's give more information
about what is going on, to the developer.
2016-10-23 18:44:37 +08:00
Ilya P f6ad50ce94 - added getFile method 2016-10-23 13:29:18 +03:00
Andres G. Aragoneses bbc84f0748 Tests: put API settings also in app.config
For these tests to pass you not only needed to change
the app.config file but the .cs file as well with your
API settings (Hash & ID).

So let's put everything of them in the app.config so
it's easier to discover.
2016-10-23 18:11:26 +08:00
Ilya P 1d6035aeb7 - fix file Uploader
- refactor file uploader
- added test for file uploading
2016-10-23 13:02:44 +03:00
Andres G. Aragoneses d96daec6d1 Tests: remove unneeded usings 2016-10-23 17:00:52 +08:00
Ilya P 7fd0413c7e - removed non-generic TLVector
- write length of Vector during Serialization
2016-10-23 11:17:59 +03:00