nexus
Core API

Error Reference

Error boundaries and commonly handled stable Nexus error codes.

Nexus errors carry a stable code, a message, and diagnostic context/cause when available. Use the safe entry point’s inferred error union for narrowing rather than a blanket Error cast. See Errors and timeouts for handling patterns.

Public Error Unions

TypeBoundary
ConnectionAcquireErrorsafeConnect and safeConnectMulticast
ResourceAcquireErrorsafeGet and each collection get Result
NexusCallErrorNexus.safeCall and typed call rejection handlers

These are unions of concrete errors, not wrapper exceptions. Configuration and other safe runtime methods currently return Result<..., Error> as declared by their signatures.

Common Codes

CodeMeaning / response
E_USAGE_INVALIDInvalid API usage or options; fix the input
E_SERVICE_AMBIGUOUSPassive single acquisition matched multiple sessions; narrow selection
E_SERVICE_ACQUISITION_TIMEOUTAcquisition budget expired
E_ABORTEDAcquisition wait was aborted
E_CONN_CLOSEDThe bound session disconnected; obtain fresh handles
E_SERVICE_UNAVAILABLEThe service is absent from the relevant session
E_AUTH_CONNECT_DENIEDConnection admission was denied
E_AUTH_CALL_DENIEDThe requested operation was denied
E_CALL_TIMEOUTLocal call waiting expired; remote execution may have occurred
E_REMOTE_EXCEPTIONRemote business code threw
E_PROVIDER_DUPLICATE_TOKENA provider submission contains duplicate IDs

This table lists common application-facing codes, not every transport or protocol variant. The exported concrete classes include NexusUsageError, NexusDisconnectedError, NexusServiceError, NexusResourceError, NexusRemoteError, NexusConnectionError, NexusConnectionConstraintFailedError, NexusProtocolIncompatibleError, NexusHandshakeError, NexusTransportError, NexusEndpointConnectError, NexusEndpointListenError, NexusEndpointCapabilityError, and NexusProtocolError.

Framework failures keep their own classification when carried back from a peer. A business exception cannot impersonate a framework error by using the same code; it is reported as NexusRemoteError. Its serialized original error is retained for diagnosis.

instanceof is useful within the same installed Core copy. Prefer code when handling serialized errors or applications with multiple package copies.

Edit this page on GitHub