TS · 12

Protocol errors

As in Python, protocol misuse throws DendriteProtocolError (exported with the alias CortexProtocolError) - e.g. when you emit() a type outside SYNAPSE_TYPES. The Engram surface throws EngramError subclasses, Pathways throw PathwayClosedError when closed early, and envelope validation failures throw a plain Error.

errors.ts
import { DendriteProtocolError, EngramTimeout, PathwayClosedError } from "@cosmonapse/sdk";

try {
  await dendrite.emit(someAgentOutputSignal);   // AGENT_OUTPUT is Axon-owned
} catch (e) {
  if (e instanceof DendriteProtocolError) {
    // Dendrites may only emit SYNAPSE_TYPES.
  }
}
// CortexProtocolError is an exported alias of DendriteProtocolError.
// Engram I/O throws EngramError subclasses (EngramTimeout / EngramNotBound / …);
// a Pathway closed before its Signal arrives throws PathwayClosedError.

Have a feature in mind?

The protocol, SDKs, and CLI are still pre-1.0. If something here is missing, ambiguous, or wrong - open an issue and propose a change. Every breaking change is debated in DECISIONS.md first.