Commit graph

20 commits

Author SHA1 Message Date
Afshin Arani 6f9c328349 Add Cloud Password Support 2016-11-16 17:01:00 +03:30
Eugene Timokhov 8b2f227142 Added possibility to do ping request (SendPingAsync method) 2016-11-07 02:40:19 +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
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 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 P b06f8a8e11 Added File-Migrate feature 2016-10-29 11:47:18 +03: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 P 7fd0413c7e - removed non-generic TLVector
- write length of Vector during Serialization
2016-10-23 11:17:59 +03:00
Andres G. Aragoneses 77867b44e6 Use better exception handling
Parsing the message of an exception to decide what to do
next is a bad practice, because it's easy that the message
might be changed by mistake in the future. To enforce the
coupling in a stronger way it's better to use exceptions
of different type depending on the kind of error, so that
we rely on the compiler enforcing the behaviour when doing
changes in this error handling areas in the future.

This also makes the code a bit more simple and readable.
2016-10-22 22:00:15 +08:00
Afshin Arani 6af7c66a81 Redesign Everything 2016-09-24 17:08:26 +03:30
David Woakes 15a51818f9 Fix spelling of Receive 2016-07-20 08:09:27 +01:00
David Woakes 8026bd79dc Fix issues with GetDialogs
Default value of max_id = 0 returns all dialogs
Should return a class with lists of dialog, messages, chats and users.
Add UserForeignConstructor to list of constructors
Add missing detail to DialogConstructor (PeerNotifySettings)
Unpack datastream completely to avoid issue with Ionic exception causing
problems in userForeign parsing
Use more recent code for Dialog construction
2016-07-19 14:47:08 +01:00
ahmadali shafiee 504b63a6d7 formatting code (ctrl + k + d) 2016-04-18 15:20:57 +04:30
Ilya Pirozhneko 9cc6942088 Added tests and fixes to SendMediaFunctionality and GetHistory 2016-02-03 22:36:39 +03:00
Ilya Pirozhneko 824ba77e12 Added auto dc switching 2016-01-27 14:02:18 +03:00
Ilya Pirozhneko b0a824988d Add proper exception messages 2015-10-01 20:55:02 +08:00
Ilya Pirozhneko 3bb487a194 TLSharp and Tests 2015-09-28 10:01:17 +08:00