zvault/src/repository/error.rs

110 lines
3.5 KiB
Rust
Raw Permalink Normal View History

2017-07-21 09:21:59 +00:00
use prelude::*;
2017-03-21 10:28:11 +00:00
2017-03-16 08:42:30 +00:00
use std::io;
use std::path::PathBuf;
2017-03-24 08:26:55 +00:00
use super::backup_file::BackupFileError;
use super::backup::BackupError;
2017-03-16 08:42:30 +00:00
use super::bundle_map::BundleMapError;
use super::config::ConfigError;
2017-03-22 08:19:16 +00:00
use super::metadata::InodeError;
2017-03-16 08:42:30 +00:00
quick_error!{
#[derive(Debug)]
2017-03-22 13:42:27 +00:00
#[allow(unknown_lints,large_enum_variant)]
2017-03-16 08:42:30 +00:00
pub enum RepositoryError {
NoRemote {
description("Remote storage not found")
display("Repository error: The remote storage has not been found, may be it needs to be mounted?")
}
2017-03-22 08:19:16 +00:00
Index(err: IndexError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Index error")
display("Repository error: index error\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
BundleDb(err: BundleDbError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Bundle error")
display("Repository error: bundle db error\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
BundleWriter(err: BundleWriterError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Bundle write error")
display("Repository error: failed to write to new bundle\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
BackupFile(err: BackupFileError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Backup file error")
display("Repository error: backup file error\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
Chunker(err: ChunkerError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Chunker error")
display("Repository error: failed to chunk data\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
Config(err: ConfigError) {
2017-03-21 09:52:48 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Configuration error")
display("Repository error: configuration error\n\tcaused by: {}", err)
2017-03-21 09:52:48 +00:00
}
2017-03-22 08:19:16 +00:00
Inode(err: InodeError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Inode error")
display("Repository error: inode error\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
LoadKeys(err: EncryptionError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Failed to load keys")
display("Repository error: failed to load keys\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-22 08:19:16 +00:00
BundleMap(err: BundleMapError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("Bundle map error")
display("Repository error: bundle map error\n\tcaused by: {}", err)
2017-03-16 08:42:30 +00:00
}
Integrity(err: IntegrityError) {
2017-03-16 08:42:30 +00:00
from()
cause(err)
description("Integrity error")
2017-03-22 08:19:16 +00:00
display("Repository error: integrity error\n\tcaused by: {}", err)
2017-03-18 16:22:11 +00:00
}
2017-04-10 18:15:13 +00:00
Dirty {
description("Dirty repository")
display("The repository is dirty, please run a check")
}
2017-03-22 10:10:13 +00:00
Backup(err: BackupError) {
from()
cause(err)
description("Failed to create a backup")
display("Repository error: failed to create backup\n\tcaused by: {}", err)
}
2017-03-24 07:56:57 +00:00
Lock(err: LockError) {
from()
cause(err)
description("Failed to obtain lock")
display("Repository error: failed to obtain lock\n\tcaused by: {}", err)
}
2017-03-22 08:19:16 +00:00
Io(err: io::Error) {
2017-03-18 16:22:11 +00:00
from()
cause(err)
2017-03-22 08:19:16 +00:00
description("IO error")
display("IO error: {}", err)
2017-03-16 08:42:30 +00:00
}
2017-03-16 12:59:57 +00:00
NoSuchFileInBackup(backup: Backup, path: PathBuf) {
description("No such file in backup")
display("The backup does not contain the file {:?}", path)
}
2017-03-16 08:42:30 +00:00
}
}