Skip to content

miniproto.errors.classify_rpc_error

classify_rpc_error(error: RpcError) -> RpcError

Return the most specific public error matching a raw Telegram RPC error.

Migration and flood suffixes preserve their extracted DC or wait duration; generated schema classes take precedence, followed by known exact errors and numeric status classes. Unknown errors are returned unchanged.

Parameters:

  • error (RpcError) – Raw or already classified RPC error to inspect.

Returns:

  • RpcError – The same instance when no classification applies, otherwise a specific
  • RpcError – error that preserves message, code, request, and context.