Errors¶
The roots. Every error Telegram documents is also reachable by name from
sunnygram.errors, generated from Telegram's own table with the published explanation as
its docstring, and not listed here because there are 780 of them. See
Errors for the shape of the tree and how to catch things.
Refusals¶
sunnygram.errors.rpc.RPCError ¶
sunnygram.errors.rpc.NotAcceptable ¶
Bases: RPCError
406, the call was understood and the client is expected to know why.
Telegram answers this where showing the message to someone would be worse than saying nothing, so a client is meant to handle it quietly instead of put it on screen.
sunnygram.errors.rpc.InternalError ¶
sunnygram.errors.rpc.Timeout ¶
Waiting¶
sunnygram.errors.rpc.SlowmodeWait ¶
sunnygram.errors.rpc.TakeoutInitDelay ¶
Migrations¶
sunnygram.errors.rpc.Migrate ¶
Signing in¶
sunnygram.errors.rpc.SessionPasswordNeeded ¶
sunnygram.errors.rpc.PhoneCodeInvalid ¶
sunnygram.errors.rpc.PhoneCodeExpired ¶
sunnygram.errors.rpc.PhoneNumberInvalid ¶
sunnygram.errors.rpc.PasswordHashInvalid ¶
sunnygram.errors.rpc.AuthTokenExpired ¶
sunnygram.errors.rpc.AuthTokenInvalid ¶
Everything else¶
sunnygram.errors.base.SunnygramError ¶
Bases: Exception
Base class for every error the library raises.
sunnygram.errors.base.TLError ¶
Bases: SunnygramError
Something went wrong encoding or decoding the binary TL format.
sunnygram.errors.base.TransportError ¶
Bases: SunnygramError
Something went wrong below MTProto, on the connection itself.
sunnygram.errors.base.SecurityError ¶
Bases: SunnygramError
A cryptographic check did not hold.
Always fatal. There is no safe way to carry on with data that failed one of these, so nothing catches it to retry.
sunnygram.errors.base.PeerNotFound ¶
Bases: SunnygramError
Nothing known can name this person or chat to the server.
MTProto refers to almost everyone by an id and an access hash together, and the hash is only ever learned by being told it. So this is not the server saying no: it is the client saying it has never seen this peer and has no way to ask about it. Resolving a username, or anything that makes the peer arrive alongside an update, fixes it for good.
sunnygram.errors.base.FileTooLarge ¶
Bases: SunnygramError
A download turned out to be bigger than the caller allowed for.
Building one¶
sunnygram.errors.rpc.rpc_error ¶
Build the most specific error that fits what the server said.
An error the table has never heard of, which is what an error added since the last refresh looks like, comes back as its status code and keeps its message. Nothing is guessed from the shape of the name: a message merely ending in digits is not a message carrying a number.