Package com.surrealdb

Class ServerException

java.lang.Object
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AlreadyExistsException, ConfigurationException, InternalException, NotAllowedException, NotFoundException, QueryException, SerializationException, ThrownException, ValidationException

public class ServerException extends SurrealException
Base class for all exceptions originating from the SurrealDB server.

Carries structured error information: a machine-readable kind, optional details using the {kind, details?} wire format, and an optional typed cause chain.

Details follow the internally-tagged format where each detail object has a "kind" field and an optional "details" field:

  • Unit variant: {"kind": "Parse"}
  • Newtype variant: {"kind": "Auth", "details": {"kind": "TokenExpired"}}
  • Struct variant: {"kind": "Table", "details": {"name": "users"}}

For backward compatibility with older servers, the legacy externally-tagged format ("Parse", {"Auth": "TokenExpired"}, {"Table": {"name": "users"}}) is also supported by all detail helpers.

Specific error kinds are represented by subclasses (e.g. NotAllowedException, NotFoundException). When the server returns an unknown kind, a plain ServerException is used (not InternalException) to preserve forward compatibility.

See Also: