AxiomCore
Reference & Appendix

Runtime errors

Structured failure stages, categories, symbolic codes, retryability, and safe handling.

The Axiom Runtime represents a failed operation as a structured AxiomError. Framework bindings can change naming conventions during serialization, but the semantic fields are:

FieldMeaning
stagePipeline boundary where the failure occurred
categoryBroad class used for UI, metrics, and policy
codeSpecific symbolic condition; an HTTP status can carry its number
messageHuman-oriented summary safe for application handling
retryableRuntime assessment of whether another attempt may succeed
detailsOptional additional context
sourceOptional internal source context; bindings may omit it

Do not parse message to make control-flow decisions. Match the typed or serialized code, and preserve an unknown fallback so a newer runtime does not break an older UI.

Stages

StageBoundary
ConfigurationRuntime or contract configuration
ContractLoadArtifact loading or validation
RequestBuildEndpoint lookup, path, headers, or body construction
ValidationRequestOutbound value did not satisfy the contract
CacheReadReading a configured cache
NetworkSendEstablishing or sending the request
NetworkReceiveReceiving transport or HTTP response data
ValidationResponseInbound value did not satisfy the contract
DeserializeJSON or codec decoding
CacheWritePersisting a response cache entry
RuntimeEngine lifecycle or internal execution
FfiBoundaryNative/Wasm binding boundary

Serialized clients can expose lower-camel-case equivalents. Confirm the actual binding type rather than hard-coding display text.

Categories

Contract, Validation, Network, Timeout, Serialization, Cache, Auth, Server, Runtime, and Unknown are the current runtime categories. A category is intentionally broader than the code: for example, several HTTP statuses can map to Auth or Server behavior.

Symbolic codes

GroupCodes
ContractContractMissing, ContractInvalid, EndpointNotFound
RequestRequestCreationError, PayloadEncodingError
ValidationValidationError
NetworkNetworkConnectionFailed, NetworkTimeout, HttpStatus(status)
DataJsonParseError, CodecError
CacheCacheReadError, CacheWriteError
AuthenticationAuthTokenMissing, AuthTokenExpired
RuntimeNotInitialized, InternalError

Numeric FFI status values are a lower-level compatibility boundary and can collapse several symbolic codes. Application code should use the structured error emitted by its binding rather than copying a numeric table.

Handling pattern

function messageFor(error: AxiomError): string {
  if (error.category === 'Auth') return 'Please sign in again.';
  if (error.retryable) return 'Request failed. Try again.';
  if (error.code === 'ContractInvalid') {
    return 'This application release has an invalid data contract.';
  }
  return 'Something went wrong.';
}

The exact enum casing in generated TypeScript or Dart is authoritative. Keep detailed diagnostic context in protected logs, not in a user-visible message.

Retry guidance

  • retry only when the error says it is retryable or application policy explicitly permits it;
  • cap attempts and add jitter for network retries;
  • do not retry an invalid contract, unknown endpoint, request validation, or deterministic decoding failure without changing input or deployment;
  • refresh or clear credentials before retrying an authentication failure; and
  • treat cache errors separately from network success so a write failure does not masquerade as a failed server operation.

On this page