database_mcp_backend/
error.rs1#[derive(Debug, thiserror::Error)]
9pub enum AppError {
10 #[error("Database connection error: {0}")]
12 Connection(String),
13
14 #[error("Query blocked: only SELECT, SHOW, DESC, DESCRIBE, USE queries are allowed in read-only mode")]
16 ReadOnlyViolation,
17
18 #[error("Operation forbidden: LOAD_FILE() is not allowed for security reasons")]
20 LoadFileBlocked,
21
22 #[error("Operation forbidden: SELECT INTO OUTFILE/DUMPFILE is not allowed for security reasons")]
24 IntoOutfileBlocked,
25
26 #[error("Query blocked: only single statements are allowed")]
28 MultiStatement,
29
30 #[error("Invalid identifier '{0}': must not be empty, whitespace-only, or contain control characters")]
32 InvalidIdentifier(String),
33
34 #[error("Database error: {0}")]
36 Query(String),
37
38 #[error("Table not found: {0}")]
40 TableNotFound(String),
41}