rlqt_lib/errors.rs
1// Copyright (C) 2025-2026 Michael S. Klishin and Contributors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14use duckdb::Error as DuckDbError;
15use std::io::Error as IoError;
16use thiserror::Error;
17
18#[derive(Error, Debug)]
19#[non_exhaustive]
20pub enum Error {
21 #[error("Database error: {0}")]
22 Database(#[from] DuckDbError),
23
24 #[error("IO error: {0}")]
25 Io(#[from] IoError),
26
27 #[error("Database connection pool error: {0}")]
28 ConnectionPool(String),
29
30 #[error("Failed to parse log entry at line {line}: {reason}")]
31 ParseEntry { line: usize, reason: String },
32
33 #[error("Failed to parse timestamp: {0}")]
34 ParseTimestamp(String),
35
36 #[error("Failed to read log file at line {line}: {source}")]
37 ReadLine {
38 line: usize,
39 #[source]
40 source: IoError,
41 },
42}