Documentation / @agentick/shared / ValidationError
Class: ValidationError ​
Defined in: errors.ts:308
Error thrown when input validation fails.
Example ​
throw new ValidationError('messages', 'Messages are required');
throw new ValidationError('handler', 'Handler function required', { expected: 'function' });
throw new ValidationError('input.model', 'Model identifier must be provided');Extends ​
Constructors ​
Constructor ​
new ValidationError(
field,message,options?,cause?):ValidationError
Defined in: errors.ts:318
Parameters ​
field ​
string
message ​
string
options? ​
code? ​
"VALIDATION_REQUIRED" | "VALIDATION_TYPE" | "VALIDATION_FORMAT" | "VALIDATION_CONSTRAINT"
expected? ​
string
received? ​
string
cause? ​
Error
Returns ​
ValidationError
Overrides ​
Properties ​
cause? ​
readonlyoptionalcause:Error
Defined in: errors.ts:108
Original error that caused this error
Inherited from ​
code ​
readonlycode:AgentickErrorCode
Defined in: errors.ts:102
Unique error code for programmatic handling
Inherited from ​
details ​
readonlydetails:Record<string,unknown>
Defined in: errors.ts:105
Additional error details
Inherited from ​
expected? ​
readonlyoptionalexpected:string
Defined in: errors.ts:313
Expected type or format (optional)
field ​
readonlyfield:string
Defined in: errors.ts:310
Field or parameter that failed validation
received? ​
readonlyoptionalreceived:string
Defined in: errors.ts:316
Actual value received (optional)
Methods ​
fromJSON() ​
staticfromJSON(json):AgentickError
Defined in: errors.ts:169
Create error from serialized format
Parameters ​
json ​
Returns ​
Inherited from ​
required() ​
staticrequired(field,message?):ValidationError
Defined in: errors.ts:353
Create a "required" validation error
Parameters ​
field ​
string
message? ​
string
Returns ​
ValidationError
toJSON() ​
toJSON():
SerializedAgentickError
Defined in: errors.ts:137
Serialize error for transport (JSON-safe)
Returns ​
Inherited from ​
type() ​
statictype(field,expected,received?):ValidationError
Defined in: errors.ts:362
Create a "type mismatch" validation error
Parameters ​
field ​
string
expected ​
string
received? ​
string
Returns ​
ValidationError