pub enum AppError {
BadRequest(String),
NotFound(String),
Internal(LogdiveError),
}Expand description
HTTP error surface used across all handlers.
Variants§
BadRequest(String)
Client sent a malformed request. Message is user-facing.
NotFound(String)
A specific resource was not present. Message is user-facing.
Reserved for future endpoints that look up by id. The current
GET /query and GET /stats never emit this; returning zero
matches from a query is a 200 OK with an empty body, not a 404.
Internal(LogdiveError)
Unexpected internal failure. The underlying LogdiveError is
kept for operator-side logging and is never exposed to the
client.
Implementations§
Trait Implementations§
Source§impl From<LogdiveError> for AppError
Map LogdiveError variants to appropriate HTTP error classes.
impl From<LogdiveError> for AppError
Map LogdiveError variants to appropriate HTTP error classes.
This is the single source of truth for classification — handlers simply
use ? and rely on this impl to do the right thing. Anything that
looks like “the user sent something bad” becomes BadRequest;
anything else becomes Internal.
Source§fn from(err: LogdiveError) -> Self
fn from(err: LogdiveError) -> Self
Source§impl From<QueryParseError> for AppError
Explicit bridge from QueryParseError to AppError.
impl From<QueryParseError> for AppError
Explicit bridge from QueryParseError to AppError.
parse_query in core returns Result<_, QueryParseError> directly,
not wrapped in LogdiveError. Rust’s ? only performs a single
conversion via From, so even though LogdiveError: From<QueryParseError>
is defined in core, callers using ? on parse_query(...)? from an
AppError-returning function need a direct impl. We delegate to the
LogdiveError path so classification stays in one place.