BadArgumentError 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 class BadArgumentclass BadArgument {
message: string;
name: string;
stack: string;
cause: unknown;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
_tag: Tag;
module: string;
method: string;
description: string | undefined;
}
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.
BadArgument extends import DataData.TaggedError("BadArgument")<{
module: stringmodule: string
method: stringmethod: string
description?: string | undefineddescription?: string | undefined
cause?: unknowncause?: 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 BadArgument.message: stringFormats 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.
message(): string {
return `${this.module}.${this.method}${this.description ? `: ${this.description}` : ""}`
}
}