#[non_exhaustive]pub enum Error {
Show 22 variants
Config(String),
Io(Error),
Figment(Box<Error>),
Sqlx(Error),
Migrate(MigrateError),
Cbor(CborError),
Crypto(CryptoError),
Signing(String),
LeaseHeld {
instance_id: String,
age_secs: u64,
},
LabelNotFound {
src: String,
uri: String,
val: String,
},
ReportNotFound {
id: i64,
},
ReportAlreadyResolved {
id: i64,
},
ReasonNotFound(String),
DurationRequiredForTempSuspension,
DurationOnlyForTempSuspension,
ActionNotFound(i64),
ActionAlreadyRevoked(i64),
SubjectUriMismatch,
StrikeCacheMissing(String),
PendingActionNotFound(i64),
PendingAlreadyResolved(i64),
SubjectTakendown(String),
}Expand description
Top-level error type for the cairn-mod library.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
Configuration loading or validation failed.
Io(Error)
I/O failure (filesystem, stdio, etc.).
Figment(Box<Error>)
Figment config-source failure (TOML parse, env-var extraction).
Sqlx(Error)
SQLx query or connection failure.
Migrate(MigrateError)
Embedded migration runner failed.
Cbor(CborError)
DAG-CBOR encode / decode failure from proto-blue-lex-cbor.
Crypto(CryptoError)
Cryptographic primitive failure (signing, hashing, key parse).
Signing(String)
Invariant violation specific to label signing (e.g. missing sig,
wrong algorithm in the multibase key, sig-length mismatch).
LeaseHeld
Another Cairn instance holds a fresh lease on the same SQLite file (§F5 single-instance invariant). Refusing to start — the other instance must shut down or its lease must age past 60s.
Fields
LabelNotFound
Negating a label that does not currently apply. Either the tuple
(src, uri, val) has no apply events, or the most recent event for
the tuple is already a negation (§F6).
Fields
ReportNotFound
resolveReport (§F12) targeted a report id that doesn’t exist.
Surface via the handler as ReportNotFound (declared lexicon error).
ReportAlreadyResolved
resolveReport (§F12) targeted a report that is already resolved.
Surface via the handler as InvalidRequest with a generic message
(no timestamps or resolver DID per the anti-leak principle).
ReasonNotFound(String)
recordAction (§F20, #51) carried a reason identifier that
isn’t declared in the operator’s [moderation_reasons]
vocabulary. Handler surfaces this as InvalidReason (400).
DurationRequiredForTempSuspension
recordAction (§F20, #51) was called with type=temp_suspension
but no duration. Handler surfaces this as DurationRequired
(400). Required because expires_at on the row is computed
from effective_at + duration; without one the row would
silently behave as indef_suspension.
DurationOnlyForTempSuspension
recordAction (§F20, #51) was called with a non-temp_suspension
type plus a duration. Handler surfaces this as
DurationNotAllowed (400). Strict reject (rather than silent
drop) so an operator who meant temp_suspension doesn’t end
up with an indef_suspension whose duration string is lost.
ActionNotFound(i64)
revokeAction (§F20, #51) targeted a subject_actions.id that
doesn’t exist. Handler surfaces this as ActionNotFound (404).
ActionAlreadyRevoked(i64)
revokeAction (§F20, #51) targeted a row whose revoked_at
is already non-NULL. Handler surfaces this as
ActionAlreadyRevoked (400). The schema trigger forbids
re-revocation; the recorder catches it before the UPDATE for
a clean lexicon error.
SubjectUriMismatch
recordAction (§F20, #51) was called with an at://-URI
subject whose repo DID does not match a separate
subject_did context. Reserved for future use; v1.4 derives
subject_did from the URI directly so this variant is
currently unreachable in practice but kept for the lexicon
error surface.
StrikeCacheMissing(String)
get_or_recompute_strike_count (§F20, #55) was called with
a subject_did that has no subject_strike_state row —
i.e., no actions have ever been recorded against this
subject. Same semantic as the SubjectNotFound lexicon
error from the read endpoints; the typed variant here lets
v1.5+ consumers branch on “never-actioned” cleanly (e.g.,
unwrap_or(0) for optimistic “never-actioned == 0 strikes”
semantics, or surface as a domain-specific error otherwise).
PendingActionNotFound(i64)
confirmPendingAction (§F22, #74) targeted a
pending_policy_actions.id that doesn’t exist. Handler
surfaces this as PendingActionNotFound (404).
PendingAlreadyResolved(i64)
confirmPendingAction / dismissPendingAction (§F22, #74)
targeted a row whose resolution is already non-NULL.
Handler surfaces this as PendingAlreadyResolved (400).
The schema trigger forbids a second NULL → non-NULL
transition; the recorder catches it before the UPDATE for a
clean lexicon error.
SubjectTakendown(String)
confirmPendingAction (§F22, #74) was called for a subject
that already carries an unrevoked Takedown — the action
would be redundant and conceptually undefined under the
terminal-action posture. v1.6’s auto-dismissal-on-takedown
(#76) should resolve all pendings on a takedown, so this
state is unreachable in steady state; the variant exists to
close the race between a takedown landing and an in-flight
confirm.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<CryptoError> for Error
impl From<CryptoError> for Error
Source§fn from(source: CryptoError) -> Self
fn from(source: CryptoError) -> Self
Source§impl From<MigrateError> for Error
impl From<MigrateError> for Error
Source§fn from(source: MigrateError) -> Self
fn from(source: MigrateError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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.