pub enum CliError {
Show 16 variants
Session(SessionError),
Pds(PdsError),
NotLoggedIn,
Http {
url: String,
source: Error,
},
CairnStatus {
url: String,
status: u16,
body: String,
},
MalformedResponse {
url: String,
source: Error,
},
Config(String),
KeyLoad(KeyLoadError),
MigrationFailed(String),
LeaseConflict {
instance_id: String,
age_secs: u64,
},
BindFailed {
addr: SocketAddr,
source: Error,
},
Startup(String),
ServiceRecordDrift {
pds_url: String,
service_did: String,
summary: String,
},
ServiceRecordAbsent {
pds_url: String,
service_did: String,
},
ServiceRecordUnreachable {
pds_url: String,
cause: String,
},
AuditDivergence {
table: &'static str,
row_id: i64,
expected_hash: String,
actual_hash: String,
attested_rows_before_divergence: i64,
},
}Expand description
Error sources the CLI dispatcher knows about. The human-readable
Display output is what lands on stderr; CliError::exit_code
maps variants onto the code table.
Variants§
Session(SessionError)
Session-file failure (absent, permissions, ownership, version mismatch, malformed JSON).
Pds(PdsError)
PDS interaction failure (network, unauthorized, swap-race, unexpected status, malformed response).
NotLoggedIn
Authed command ran with no session file present.
Http
Transport-level failure contacting a Cairn server URL (timeout, DNS, TLS, connection refused).
CairnStatus
Cairn returned a non-2xx HTTP status.
Fields
MalformedResponse
Cairn returned a 2xx response but the body didn’t parse as the expected shape.
Config(String)
Argument-shape failure — malformed CLI inputs, config validation failures.
KeyLoad(KeyLoadError)
Signing key file couldn’t be loaded (§5.1 invariant failure,
bad hex, wrong length, env-override attempt). Full cause lives
on the nested KeyLoadError; Display never includes the key
material because the key bytes are never decoded when an error
path runs, and KeyLoadError::Display only formats paths +
metadata.
MigrationFailed(String)
SQLite migrations failed at startup. String-only rather than wrapping sqlx’s error type to avoid leaking schema internals into the error taxonomy.
LeaseConflict
Another Cairn instance holds the single-instance lease (§F5).
Distinct variant so operators + systemd can branch on the
dedicated code::LEASE_CONFLICT exit code.
Fields
BindFailed
TcpListener::bind failed — port in use, permission denied,
malformed addr, etc.
Startup(String)
Anything in the startup sequence that doesn’t fit the buckets above (writer spawn, auth-context init). Rare at runtime; surfaces as INTERNAL.
ServiceRecordDrift
cairn serve startup verify (§F1, #8): the published
app.bsky.labeler.service record on the operator’s PDS
differs from what the local [labeler] config block would
render. Reconcile via cairn publish-service-record.
Fields
ServiceRecordAbsent
cairn serve startup verify (§F1, #8): no
app.bsky.labeler.service record exists on the operator’s
PDS for the labeler’s DID. The labeler hasn’t published
its declaration yet.
Fields
ServiceRecordUnreachable
cairn serve startup verify (§F1, #8): could not reach
the PDS to perform the verify fetch. Transient infra
issue, distinct from drift / absent — orchestrators should
retry.
Fields
AuditDivergence
cairn audit verify (#41) detected a hash-chain divergence.
The walk recomputed row_id’s row_hash from its content +
the running prev_hash and got expected_hash; the row’s
stored actual_hash did not match. Distinct exit code
(code::AUDIT_DIVERGENCE) so monitoring/CI can branch on
integrity-failure vs. generic CLI error.
The dispatcher prints the verify outcome (human or JSON) to
stdout before returning this error, so operators see the
structured report on stdout and the same message on stderr
alongside the non-zero exit. Stdout-only consumers
(cairn audit verify --json) get the JSON line; the stderr
echo is redundant for them but harmless.
Fields
table: &'static strSQL-table name of the divergent row — "audit_log" or
"pds_admin_audit". Added in #88 alongside the unified
chain walker so operators can correlate
(table, row_id) to a specific row across both tables
in v1.7+ deployments.
Implementations§
Trait Implementations§
Source§impl Error for CliError
impl Error for CliError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<KeyLoadError> for CliError
impl From<KeyLoadError> for CliError
Source§fn from(source: KeyLoadError) -> Self
fn from(source: KeyLoadError) -> Self
Source§impl From<SessionError> for CliError
impl From<SessionError> for CliError
Source§fn from(source: SessionError) -> Self
fn from(source: SessionError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for CliError
impl !UnwindSafe for CliError
impl Freeze for CliError
impl Send for CliError
impl Sync for CliError
impl Unpin for CliError
impl UnsafeUnpin for CliError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.