Documentation / @agentick/shared / ContextError
Class: ContextError
Defined in: errors.ts:608
Error thrown when context is missing or invalid.
Example
throw new ContextError('Context not found. Ensure you are running within Context.run()');
throw new ContextError('Invalid context: missing required field', 'CONTEXT_INVALID');Extends
Constructors
Constructor
new ContextError(
message,code?,details?,cause?):ContextError
Defined in: errors.ts:609
Parameters
message
string
code?
"CONTEXT_NOT_FOUND" | "CONTEXT_INVALID"
details?
Record<string, unknown> = {}
cause?
Error
Returns
ContextError
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
Methods
fromJSON()
staticfromJSON(json):AgentickError
Defined in: errors.ts:169
Create error from serialized format
Parameters
json
Returns
Inherited from
notFound()
staticnotFound():ContextError
Defined in: errors.ts:622
Create "context not found" error with helpful message
Returns
ContextError
toJSON()
toJSON():
SerializedAgentickError
Defined in: errors.ts:137
Serialize error for transport (JSON-safe)