Documentation
¶
Overview ¶
Package errors provides structured error types, error codes, and exit codes for xsql.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code string
Code is a stable error code (string) for AI/agent and programmatic consumption. Codes are append-only; existing meanings must not be changed or reused.
const ( // Config / args CodeCfgNotFound Code = "XSQL_CFG_NOT_FOUND" CodeCfgInvalid Code = "XSQL_CFG_INVALID" CodeSecretNotFound Code = "XSQL_SECRET_NOT_FOUND" // SSH CodeSSHAuthFailed Code = "XSQL_SSH_AUTH_FAILED" CodeSSHHostKeyMismatch Code = "XSQL_SSH_HOSTKEY_MISMATCH" CodeSSHDialFailed Code = "XSQL_SSH_DIAL_FAILED" // DB CodeDBDriverUnsupported Code = "XSQL_DB_DRIVER_UNSUPPORTED" CodeDBConnectFailed Code = "XSQL_DB_CONNECT_FAILED" CodeDBAuthFailed Code = "XSQL_DB_AUTH_FAILED" CodeDBExecFailed Code = "XSQL_DB_EXEC_FAILED" // Read-only policy CodeROBlocked Code = "XSQL_RO_BLOCKED" // Port CodePortInUse Code = "XSQL_PORT_IN_USE" // Internal CodeInternal Code = "XSQL_INTERNAL" )
type ExitCode ¶
type ExitCode int
ExitCode represents process exit codes (stable contract); see docs/error-contract.md.
const ( ExitOK ExitCode = 0 // 2: argument/configuration error ExitConfig ExitCode = 2 // 3: connection error (DB/SSH) ExitConnect ExitCode = 3 // 4: read-only policy blocked a write ExitReadOnly ExitCode = 4 // 5: DB execution error ExitDBExec ExitCode = 5 // 10: internal error ExitInternal ExitCode = 10 )
func ExitCodeFor ¶
type XError ¶
type XError struct {
Code Code `json:"code" yaml:"code"`
Message string `json:"message" yaml:"message"`
Details map[string]any `json:"details,omitempty" yaml:"details,omitempty"`
// contains filtered or unexported fields
}
XError is a structured error that conforms to docs/error-contract.md.
Click to show internal directories.
Click to hide internal directories.