pub enum ApiError {
Show 18 variants
Unauthorized,
Forbidden,
IndexerBackpressureUpsert,
IndexerBackpressureTombstone,
EventPublishFailed {
after: WriteEffect,
},
ReconcileInProgress,
ReconcileUnsupported,
EventsGone {
requested: EventId,
oldest: EventId,
},
EventsUnavailable {
message: String,
},
Core(Error),
Storage(StorageError),
PreconditionFailed,
RangeNotSatisfiable {
complete_length: u64,
},
NotModified,
MalformedRange(String),
LineRangeNotSatisfiable {
line_total: u64,
byte_total: u64,
},
ReplaceNoMatch,
ReplaceAmbiguous {
count: u64,
},
}Expand description
HTTP-layer error — maps domain and storage errors to HTTP status codes.
Variants§
The request lacked valid Bearer credentials.
Forbidden
The credential is valid, but the knowledge base’s access policy does not grant this operation on this key.
Distinct from Self::Unauthorized on purpose: 401 tells a caller
that credentials might help, and 403 tells them that theirs are fine
and the answer is still no. D43 reserved this code for exactly this.
IndexerBackpressureUpsert
Indexer queue was full while enqueueing an upsert (PUT/COPY).
IndexerBackpressureTombstone
Indexer queue was full while enqueueing a tombstone (DELETE).
EventPublishFailed
The change event could not be published after storage had already
taken the write (D55). Answered like indexer backpressure: 503 with
Retry-After, so the client retries the idempotent write.
Fields
after: WriteEffectWhat storage had already done.
ReconcileInProgress
A reconciliation pass for this knowledge base is already running (D67).
ReconcileUnsupported
The storage backend has no on-demand reconciliation pass (D67).
EventsGone
A Last-Event-ID older than what the event log retains.
Fields
The event log could not be subscribed to.
Core(Error)
A domain error from notedthat-core.
Built through the manual From<CoreError> rather than #[from], so a
CoreError::Storage(BucketNotFound) — which core’s own From<StorageError>
produces — is caught on the way in and answered like every other missing
bucket, with no bucket name on the wire.
Storage(StorageError)
A storage-layer error not otherwise promoted to a top-level variant.
Note: StorageError::NotModified, StorageError::PreconditionFailed, and
StorageError::RangeNotSatisfiable are promoted via the manual From<StorageError>
impl to top-level ApiError variants so that IntoResponse can emit the
RFC-required headers (e.g. Content-Range: bytes */N for 416).
PreconditionFailed
A conditional PUT/DELETE failed because a precondition was not met.
Maps to HTTP 412 Precondition Failed.
RangeNotSatisfiable
The requested byte range could not be satisfied.
complete_length is the total object size in bytes. The IntoResponse
impl emits Content-Range: bytes */complete_length per RFC 7233 §4.4.
NotModified
The backend returned 304 Not Modified for a conditional GET/HEAD.
Maps to HTTP 304 with no body, as required by RFC 7232 §4.1.
MalformedRange(String)
The Range: header value could not be parsed per RFC 7233.
Maps to HTTP 400 Bad Request.
LineRangeNotSatisfiable
A Range: lines=… header specified a range that exceeds the object’s line count.
Maps to HTTP 416 with Content-Range: lines */<line_total> and
X-Content-Range-Bytes: */<byte_total> per the line-range extension.
Fields
ReplaceNoMatch
A single-replace operation found no occurrence of old_string.
ReplaceAmbiguous
A single-replace operation found multiple occurrences of old_string.
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
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<Error> for ApiError
Promote specific StorageError variants to top-level ApiError variants so
that IntoResponse can emit the RFC-mandated response headers.
impl From<Error> for ApiError
Promote specific StorageError variants to top-level ApiError variants so
that IntoResponse can emit the RFC-mandated response headers.
Source§impl From<StorageError> for ApiError
impl From<StorageError> for ApiError
Source§fn from(e: StorageError) -> Self
fn from(e: StorageError) -> Self
Source§impl From<WriteError> for ApiError
impl From<WriteError> for ApiError
Source§fn from(e: WriteError) -> Self
fn from(e: WriteError) -> Self
Source§impl IntoResponse for ApiError
impl IntoResponse for ApiError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Auto Trait Implementations§
impl !RefUnwindSafe for ApiError
impl !UnwindSafe for ApiError
impl Freeze for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request