2016-05-19 15:05:14 +00:00
|
|
|
generate_error_imports!();
|
2016-01-23 16:30:01 +00:00
|
|
|
use std::convert::From;
|
2016-01-12 17:51:13 +00:00
|
|
|
|
2016-05-23 13:21:16 +00:00
|
|
|
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Copy)]
|
|
|
|
pub struct CustomErrorData {}
|
|
|
|
|
|
|
|
generate_custom_error_types!(StoreError, StoreErrorKind, CustomErrorData,
|
2016-05-15 14:40:06 +00:00
|
|
|
ConfigurationError => "Store Configuration Error",
|
|
|
|
FileError => "File Error",
|
|
|
|
IoError => "IO Error",
|
|
|
|
IdLocked => "ID locked",
|
|
|
|
IdNotFound => "ID not found",
|
|
|
|
OutOfMemory => "Out of Memory",
|
|
|
|
FileNotFound => "File corresponding to ID not found",
|
|
|
|
FileNotCreated => "File corresponding to ID could not be created",
|
|
|
|
StorePathExists => "Store path exists",
|
|
|
|
StorePathCreate => "Store path create",
|
|
|
|
LockError => "Error locking datastructure",
|
|
|
|
LockPoisoned => "The internal Store Lock has been poisoned",
|
|
|
|
EntryAlreadyBorrowed => "Entry is already borrowed",
|
|
|
|
EntryAlreadyExists => "Entry already exists",
|
|
|
|
MalformedEntry => "Entry has invalid formatting, missing header",
|
|
|
|
HeaderPathSyntaxError => "Syntax error in accessor string",
|
|
|
|
HeaderPathTypeFailure => "Header has wrong type for path",
|
|
|
|
HeaderKeyNotFound => "Header Key not found",
|
|
|
|
HeaderTypeFailure => "Header type is wrong",
|
|
|
|
HookRegisterError => "Hook register error",
|
|
|
|
AspectNameNotFoundError => "Aspect name not found",
|
|
|
|
HookExecutionError => "Hook execution error",
|
|
|
|
PreHookExecuteError => "Pre-Hook execution error",
|
|
|
|
PostHookExecuteError => "Post-Hook execution error",
|
|
|
|
StorePathLacksVersion => "The supplied store path has no version part",
|
|
|
|
GlobError => "glob() error",
|
2016-05-12 13:03:57 +00:00
|
|
|
EncodingError => "Encoding error",
|
2016-05-28 21:30:50 +00:00
|
|
|
StorePathError => "Store Path error",
|
2016-03-17 12:39:32 +00:00
|
|
|
EntryRenameError => "Entry rename error",
|
2016-07-02 21:26:20 +00:00
|
|
|
StoreIdHandlingError => "StoreId handling error",
|
2016-05-28 21:30:50 +00:00
|
|
|
|
|
|
|
CreateCallError => "Error when calling create()",
|
|
|
|
RetrieveCallError => "Error when calling retrieve()",
|
|
|
|
GetCallError => "Error when calling get()",
|
|
|
|
GetAllVersionsCallError => "Error when calling get_all_versions()",
|
|
|
|
RetrieveForModuleCallError => "Error when calling retrieve_for_module()",
|
|
|
|
UpdateCallError => "Error when calling update()",
|
|
|
|
RetrieveCopyCallError => "Error when calling retrieve_copy()",
|
2016-06-08 13:04:25 +00:00
|
|
|
DeleteCallError => "Error when calling delete()",
|
|
|
|
MoveCallError => "Error when calling move()",
|
|
|
|
MoveByIdCallError => "Error when calling move_by_id()"
|
2016-05-15 14:40:06 +00:00
|
|
|
);
|
|
|
|
|
2016-06-27 15:59:46 +00:00
|
|
|
generate_result_helper!(StoreError, StoreErrorKind);
|
|
|
|
generate_option_helper!(StoreError, StoreErrorKind);
|
|
|
|
|
2016-05-23 13:21:16 +00:00
|
|
|
generate_custom_error_types!(ParserError, ParserErrorKind, CustomErrorData,
|
2016-05-15 14:40:06 +00:00
|
|
|
TOMLParserErrors => "Several TOML-Parser-Errors",
|
|
|
|
MissingMainSection => "Missing main section",
|
|
|
|
MissingVersionInfo => "Missing version information in main section",
|
|
|
|
NonTableInBaseTable => "A non-table was found in the base table",
|
|
|
|
HeaderInconsistency => "The header is inconsistent"
|
|
|
|
);
|
2016-01-12 17:51:13 +00:00
|
|
|
|
2016-01-23 16:30:01 +00:00
|
|
|
impl From<ParserError> for StoreError {
|
|
|
|
fn from(ps: ParserError) -> StoreError {
|
|
|
|
StoreError {
|
|
|
|
err_type: StoreErrorKind::MalformedEntry,
|
|
|
|
cause: Some(Box::new(ps)),
|
2016-05-23 13:21:16 +00:00
|
|
|
custom_data: None,
|
2016-01-23 16:30:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-23 15:26:02 +00:00
|
|
|
|
2016-01-24 15:01:37 +00:00
|
|
|
impl From<::std::io::Error> for StoreError {
|
|
|
|
fn from(ps: ::std::io::Error) -> StoreError {
|
|
|
|
StoreError {
|
|
|
|
err_type: StoreErrorKind::IoError,
|
|
|
|
cause: Some(Box::new(ps)),
|
2016-05-23 13:21:16 +00:00
|
|
|
custom_data: None,
|
2016-01-24 15:01:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|