Hyperlinkv0.8.0-beta.28

PlatformError

PlatformError.BadArgumentclasseffect/PlatformError.ts:36
BadArgument

Error data for an invalid argument passed to a platform API.

When to use

Use when you need to model caller input rejected before a platform operation runs, including invalid-argument reason data.

Details

The error records the module and method that rejected the argument, with an optional description and cause. It is usually wrapped in PlatformError.

export class BadArgument extends Data.TaggedError("BadArgument")<{
  module: string
  method: string
  description?: string | undefined
  cause?: unknown
}> {
  /**
   * Formats the module, method, and optional description that rejected the argument.
   *
   * **When to use**
   *
   * Use to read the formatted error message for a rejected platform argument.
   *
   * @since 4.0.0
   */
  override get message(): string {
    return `${this.module}.${this.method}${this.description ? `: ${this.description}` : ""}`
  }
}
Referenced by 3 symbols