miniproto.errors
miniproto.errors
Section titled “miniproto.errors”Redaction-safe public exceptions and Telegram RPC error classification.
Public objects
Section titled “Public objects”MiniprotoError— Base exception for all library-defined failures.ProtocolValidationError— An authenticated MTProto message violated the inbound protocol contract.AmbiguousRpcResult— The transport failed after an RPC may already have reached Telegram.RpcError— Raw or classified Telegram RPC failure with redaction-safe diagnostics.InvokeError— Base exception for raw invocation failures before Telegram returns a typed RPC error.ClientDisconnected— Raised when invocation cannot continue because the client disconnected.RequestTimeout— Raised when the client-side request deadline expires.ResultTypeMismatch— Raised when an RPC result does not match the requested result contract.BadRequest— Classified client-side Telegram RPC error, normally status code 400.Unauthorized— Classified Telegram authorization failure with status code 401.Forbidden— Classified Telegram permission failure with status code 403.NotFound— Classified Telegram missing-resource failure with status code 404.RpcTimeout— Classified Telegram-side or transport RPC timeout, commonly code -503.InternalServerError— Classified retryable server failure, normally a 5xx RPC code.FloodWait— Telegram pacing failure that exposes the required wait duration in seconds.AuthError— Base exception for authentication and authorization flow failures.InvalidCode— Authentication flow failure for a missing, expired, or invalid phone code.PasswordRequired— Authentication flow requires a configured two-factor password.PasswordInvalid— Authentication flow received an invalid two-factor password.SignUpRequired— Authentication flow requires creating a Telegram account first.AuthKeyNotFound— Authentication key is invalid, unregistered, or no longer available.AuthKeyRegenerationRequired— Authentication key is duplicated or unsynchronized and must be replaced.InvalidDatacenter— Telegram rejects the current data centre, commonly before a migration hint.DatacenterMigration— Telegram directs the request todc_idfor a named migration kind.TransportFlood— Raised for transport-level 429 responses, not ordinary RPC flood waits.PendingRpcLimitExceeded— Raised when a sender has too many in-flight RPCs and cannot accept more.SessionStorageError— Raised when session persistence cannot safely continue.SessionEnvelopeError— Raised when an encrypted session envelope fails validation or authentication.classify_rpc_error— Return the most specific public error matching a raw Telegram RPC error.