Add error module

This commit is contained in:
Matthias Beyer 2016-06-09 19:26:51 +02:00
parent f6ff775249
commit e19a30d227
2 changed files with 30 additions and 2 deletions

28
libimagref/src/error.rs Normal file
View File

@ -0,0 +1,28 @@
generate_error_module!(
generate_error_types!(RefError, RefErrorKind,
StoreReadError => "Store read error",
StoreWriteError => "Store write error",
HeaderTypeError => "Header type error",
HeaderFieldMissingError => "Header field missing error",
HeaderFieldWriteError => "Header field cannot be written",
HeaderFieldReadError => "Header field cannot be read",
HeaderFieldAlreadyExistsError => "Header field already exists, cannot override",
PathUTF8Error => "Path cannot be converted because of UTF8 Error",
PathHashingError => "Path cannot be hashed",
PathCanonicalizationError => "Path cannot be canonicalized",
TypeConversionError => "Couldn't convert types",
RefNotInStore => "Ref/StoreId does not exist in store",
RefTargetDoesNotExist => "Ref Target does not exist",
RefTargetPermissionError => "Ref Target permissions insufficient for referencing",
RefTargetCannotBeHashed => "Ref Target cannot be hashed (is it a directory?)",
RefTargetFileCannotBeOpened => "Ref Target File cannot be open()ed",
RefTargetCannotReadPermissions => "Ref Target: Cannot read permissions"
);
);
pub use self::error::RefError;
pub use self::error::RefErrorKind;

View File

@ -12,8 +12,8 @@ extern crate walkdir;
module_entry_path_mod!("ref", "0.1.0");
pub mod reference;
pub mod flags;
pub mod error;
pub mod flags;
pub mod reference;
pub mod result;