On This Page

GatewaySendError

Class in Errors · JavaScript & TypeScript

Why gateway.send did not hand a command to the shard's connection

The reason input means the shard ID, opcode or data is malformed, cannot be encoded as JSON, or encodes to more than Fluxer's 4,096-byte message limit. The reason reserved means the opcode belongs to the SDK-managed session (heartbeat, Identify or Resume) or is a server-only opcode that Fluxer answers by closing the connection. The reason notOwned means this client does not own the shard, and notReady means the shard is not currently Connected or lost its connection before the command reached the socket. The reason busy means 500 earlier gateway.send commands on that shard are still waiting for the pacing budget. Cancelling an unsent command immediately releases its queue capacity, even while the pacing window is full. None of these failures sent anything

class GatewaySendError extends FluxerlyErrorclass GatewaySendError
  extends FluxerlyError

Constructor#

Describe a command that was not sent

Construction has no side effects

new GatewaySendError(
    options: {
        readonly cause?: unknown
        readonly inputValidation?: InputValidationDetail | null
        readonly opcode?: number | null
        readonly reason:
            | "input" | "busy" | "reserved" | "notOwned"
            | "notReady"
        readonly shardId?: number | null
    }
): GatewaySendErrornew GatewaySendError(
  options: {
    readonly cause?: unknown
    readonly inputValidation?:
      | InputValidationDetail
      | null
    readonly opcode?: number | null
    readonly reason:
      | "input" | "busy"
      | "reserved" | "notOwned"
      | "notReady"
    readonly shardId?:
      | number | null
  }
): GatewaySendError

Parameters

options
cause optional

Underlying failure retained as the error's cause, such as a JSON encoding error

unknown
inputValidation optional

Safe input detail for reason input

Defaults to null

InputValidationDetail | null
opcode optional

Requested opcode, or null when the supplied value was not a valid opcode

Defaults to null

number | null
reason

Why the command was not sent

"input" | "busy" | "reserved" | "notOwned" | "notReady"| "input" | "busy" | "reserved"
| "notOwned" | "notReady"
shardId optional

Local shard ID, or null when the supplied value was not a valid shard ID

Defaults to null

number | null

Properties#

_tag#

Stable expected-failure discriminator

readonly _tag: "GatewaySendError"

inputValidation#

Safe explanation of the invalid argument for reason input, otherwise null

It never contains the rejected value

readonly inputValidation: InputValidationDetail | nullreadonly inputValidation:
  | InputValidationDetail | null

opcode#

Requested opcode, or null when the supplied opcode was not a non-negative integer

readonly opcode: number | null

reason#

Why the command was not sent

readonly reason:
    | "input" | "busy" | "reserved" | "notOwned" | "notReady"readonly reason:
  | "input" | "busy" | "reserved"
  | "notOwned" | "notReady"

shardId#

Local shard the command was for, or null when the supplied shard ID was not a non-negative integer

readonly shardId: number | null

Inherited#

Inherited from FluxerlyError: code, details, hint, toJSON