Skip to content

Documentation / @agentick/shared / ContextError

Class: ContextError

Defined in: errors.ts:608

Error thrown when context is missing or invalid.

Example

typescript
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

AgentickError.constructor

Properties

cause?

readonly optional cause: Error

Defined in: errors.ts:108

Original error that caused this error

Inherited from

AgentickError.cause


code

readonly code: AgentickErrorCode

Defined in: errors.ts:102

Unique error code for programmatic handling

Inherited from

AgentickError.code


details

readonly details: Record<string, unknown>

Defined in: errors.ts:105

Additional error details

Inherited from

AgentickError.details

Methods

fromJSON()

static fromJSON(json): AgentickError

Defined in: errors.ts:169

Create error from serialized format

Parameters

json

SerializedAgentickError

Returns

AgentickError

Inherited from

AgentickError.fromJSON


notFound()

static notFound(): 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)

Returns

SerializedAgentickError

Inherited from

AgentickError.toJSON

Released under the ISC License.