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 sea_orm::DbErr;
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] DbErr),
23
24 #[error("IO error: {0}")]
25 Io(#[from] IoError),
26
27 #[error("Failed to parse log entry at line {line}: {reason}")]
28 ParseEntry { line: usize, reason: String },
29
30 #[error("Failed to parse timestamp: {0}")]
31 ParseTimestamp(String),
32
33 #[error("Failed to read log file at line {line}: {source}")]
34 ReadLine {
35 line: usize,
36 #[source]
37 source: IoError,
38 },
39}