* Race a promise against a timeout. On timeout the returned promise REJECTS with * QuoteTimeoutError (so the caller's try/catch can report it) and the timer is * always cleared to avoid leaks. The underlying RPC is abandoned, not cancelled — * gramjs has no cancel — but it no longer blocks the co
(promise: Promise<T>, ms: number, label: string)
| 218 | class QuoteTimeoutError extends Error { |
| 219 | constructor(label: string, ms: number) { |
| 220 | super(`quote operation "${label}" timed out after ${ms}ms (likely a stalled Telegram RPC during a connection drop)`); |
| 221 | this.name = "QuoteTimeoutError"; |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Race a promise against a timeout. On timeout the returned promise REJECTS with |
| 227 | * QuoteTimeoutError (so the caller's try/catch can report it) and the timer is |
| 228 | * always cleared to avoid leaks. The underlying RPC is abandoned, not cancelled — |
| 229 | * gramjs has no cancel — but it no longer blocks the command from completing. |
| 230 | */ |
| 231 | function withTimeout<T>(promise: Promise<T>, ms: number, label: string): Promise<T> { |
no outgoing calls
no test coverage detected