ValidationError
Defined in: errors/index.ts:207
Error thrown when argument validation fails before calling the canister. Contains detailed information about which fields failed validation.
Example
Section titled “Example”try { await reactor.callMethod({ functionName: "transfer", args: [{ to: "", amount: -100 }], })} catch (error) { if (isValidationError(error)) { console.log(error.issues) // [ // { path: ["to"], message: "Recipient is required" }, // { path: ["amount"], message: "Amount must be positive" } // ] }}Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ValidationError(
methodName,issues):ValidationError
Defined in: errors/index.ts:213
Parameters
Section titled “Parameters”methodName
Section titled “methodName”string
issues
Section titled “issues”Returns
Section titled “Returns”ValidationError
Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”issues
Section titled “issues”
readonlyissues:ValidationIssue[]
Defined in: errors/index.ts:209
Array of validation issues
methodName
Section titled “methodName”
readonlymethodName:string
Defined in: errors/index.ts:211
The method name that failed validation
Methods
Section titled “Methods”getIssuesForPath()
Section titled “getIssuesForPath()”getIssuesForPath(
path):ValidationIssue[]
Defined in: errors/index.ts:229
Get issues for a specific field path
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”hasErrorForPath()
Section titled “hasErrorForPath()”hasErrorForPath(
path):boolean
Defined in: errors/index.ts:236
Check if a specific field has errors
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean