MELCloud & MELCloud Home API for Node.js - v48.2.0
    Preparing search index...

    Type Alias ApiRequestError

    ApiRequestError:
        | { entityId: number
        | string; kind: "not-found" }
        | { cause?: unknown; issue: string; kind: "validation" }
        | { cause?: unknown; kind: "network" }
        | { kind: "rate-limited"; retryAfterMs: number | null }
        | { cause?: unknown; kind: "server"; status: number }
        | { cause?: unknown; kind: "unauthorized" }

    Discriminated failure class emitted by the SDK's best-effort getters (Classic + Home telemetry, reports, and settings reads).

    Each variant carries enough context for a caller to decide how to react — distinguishing "retry this later" from "wipe the session" from "surface to user" without inspecting the logger:

    • network: transport-level failure (ECONNRESET, timeout, DNS). Transient; safe to retry.
    • unauthorized: server rejected the credential mid-flight. A full reauth is typically needed before retrying.
    • rate-limited: the SDK's internal rate-limit gate refused the call. retryAfterMs is the remaining milliseconds on the pause, or null when the upstream header did not carry a duration. This is the plain-number twin of RateLimitError.retryAfter (a Temporal.Duration); both describe the same gate window.
    • validation: Zod refused the response shape. Indicates API drift server-side; not retryable on its own — investigate.
    • server: any other HTTP error from the transport.

    Classic and Home share the same error space (same transport layer, same resilience policies); both surfaces reference this single neutral type via Result<T>.