Error formatting

This commit is contained in:
Yuriy Dupyn 2024-02-05 17:11:53 +01:00
parent e0d08e758a
commit 167028a530
2 changed files with 20 additions and 2 deletions

View file

@ -13,6 +13,8 @@ pub enum RuntimeError {
AttemptToIndexNonIndexableColumn(TableName, ColumnName), AttemptToIndexNonIndexableColumn(TableName, ColumnName),
#[error("table {0} already indexes column {1}")] #[error("table {0} already indexes column {1}")]
AttemptToIndexAlreadyIndexedColumn(TableName, ColumnName), AttemptToIndexAlreadyIndexedColumn(TableName, ColumnName),
#[error("Storage Engine error for table {0}: {1}")]
StorageEngineError(TableName, storage_engine::error::Error)
} }
#[derive(Debug, Error)] #[derive(Debug, Error)]

View file

@ -1,25 +1,41 @@
use crate::store::Column; use crate::store::Column;
use thiserror::Error;
#[derive(Debug)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {
#[error("Decoding Error: {0} {1}")]
DecodeError(DecodeErrorKind, bincode::error::DecodeError), DecodeError(DecodeErrorKind, bincode::error::DecodeError),
#[error("Encoding Error: {0}")]
EncodeError(bincode::error::EncodeError), EncodeError(bincode::error::EncodeError),
#[error("Attempt to index non-indexed column {0}")]
AttemptToIndexNonIndexableColumn(Column), AttemptToIndexNonIndexableColumn(Column),
#[error("Index Corruption: Index is storing eof file position for column {0}")]
IndexIsStoringEofFilePosition(Column), IndexIsStoringEofFilePosition(Column),
#[error("Column {0} is already indexed")]
ColumnAlreadyIndexed(Column), ColumnAlreadyIndexed(Column),
#[error("File-System Error: {0}")]
IoError(std::io::Error), IoError(std::io::Error),
} }
#[derive(Debug)] #[derive(Debug, Error)]
pub enum DecodeErrorKind { pub enum DecodeErrorKind {
#[error("StoreHeaderNumberOfColumns")]
StoreHeaderNumberOfColumns, StoreHeaderNumberOfColumns,
#[error("StoreHeaderDeletedCount")]
StoreHeaderDeletedCount, StoreHeaderDeletedCount,
#[error("StoreHeaderTotalCount")]
StoreHeaderTotalCount, StoreHeaderTotalCount,
#[error("StoreHeaderPrimaryColumn")]
StoreHeaderPrimaryColumn, StoreHeaderPrimaryColumn,
#[error("StoreHeaderIndexedColumns")]
StoreHeaderIndexedColumns, StoreHeaderIndexedColumns,
#[error("EntryData")]
EntryData, EntryData,
#[error("EntryIsDeleted")]
EntryIsDeleted, EntryIsDeleted,
#[error("EntryHeaderWithDataSizes")]
EntryHeaderWithDataSizes, EntryHeaderWithDataSizes,
#[error("CorruptedData")]
CorruptedData, CorruptedData,
} }