gitdataai/libs/room/src/error.rs
ZhenYi f5e3da35b0 feat(room): store ordered streaming chunks + billing integration
- Save thinking_content as {"__chunks__": [{type, content}]} for replay
- Tool call sanitization — don't expose raw results to frontend
- Billing record_ai_usage integration
- Room service module refactoring into service/ directory
2026-04-26 13:10:42 +08:00

41 lines
824 B
Rust

use thiserror::Error;
#[derive(Error, Debug)]
pub enum RoomError {
#[error("Database error: {0}")]
Database(#[from] sea_orm::DbErr),
#[error("Not found: {0}")]
NotFound(String),
#[error("Unauthorized")]
Unauthorized,
#[error("No power / permission denied")]
NoPower,
#[error("Rate limited: {0}")]
RateLimited(String),
#[error("Bad request: {0}")]
BadRequest(String),
#[error("Role parse error")]
RoleParseError,
#[error("Internal error: {0}")]
Internal(String),
}
impl From<anyhow::Error> for RoomError {
fn from(e: anyhow::Error) -> Self {
RoomError::Internal(e.to_string())
}
}
impl From<agent::error::AgentError> for RoomError {
fn from(e: agent::error::AgentError) -> Self {
RoomError::Internal(e.to_string())
}
}