Class: PlotError

The common base class for failures produced by the Plot Game SDK.

Catch this class when one handler should cover startup, connection, and realtime operation failures. Invalid arguments and values rejected by local validation use the native TypeError class; failures reported by Plot use PlotError. A game-provided schema may surface its own error unchanged.

Example

import Plot, { PlotError } from '@plot.game/sdk'

try {
  await Plot.ready()
} catch (error) {
  if (error instanceof PlotError) {
    console.error(error.code, error.message)
  }
}

See

Error handling

Extends

  • Error

Extended by

Constructors

Constructor

new PlotError(code, message, options?): PlotError

Creates a Plot SDK error.

Parameters

code

PlotErrorCode

The stable machine-readable failure reason.

message

string

A human-readable explanation for diagnostics.

options?

PlotErrorOptions

Optional diagnostic information.

Returns

PlotError

Overrides

Error.constructor

Properties

cause?

readonly optional cause?: unknown

The lower-level error that caused this failure, when one exists.


code

readonly code: PlotErrorCode

The stable machine-readable failure reason.