Rewrite macros to do error-chain behind the scenes
This commit is contained in:
parent
279afd1972
commit
e77d353c52
26 changed files with 1152 additions and 621 deletions
|
@ -17,12 +17,24 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(StoreError, StoreErrorKind,
|
types {
|
||||||
BackendError => "Backend Error",
|
StoreError, StoreErrorKind, ResultExt, Result;
|
||||||
NoCommandlineCall => "No commandline call"
|
}
|
||||||
);
|
|
||||||
);
|
errors {
|
||||||
|
BackendError {
|
||||||
|
description("Backend Error")
|
||||||
|
display("Backend Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
NoCommandlineCall {
|
||||||
|
description("No commandline call")
|
||||||
|
display("No commandline call")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::StoreError;
|
pub use self::error::StoreError;
|
||||||
pub use self::error::StoreErrorKind;
|
pub use self::error::StoreErrorKind;
|
||||||
|
|
|
@ -16,3 +16,4 @@ homepage = "http://imag-pim.org"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
ansi_term = "0.9"
|
ansi_term = "0.9"
|
||||||
|
error-chain = "0.10"
|
||||||
|
|
|
@ -17,138 +17,55 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! generate_error_imports {
|
|
||||||
() => {
|
|
||||||
use std::error::Error;
|
|
||||||
use std::fmt::Error as FmtError;
|
|
||||||
use std::fmt::{Display, Formatter};
|
|
||||||
|
|
||||||
use $crate::into::IntoError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! generate_error_module {
|
macro_rules! generate_error_module {
|
||||||
( $exprs:item ) => {
|
( $exprs:item ) => {
|
||||||
pub mod error {
|
pub mod error {
|
||||||
generate_error_imports!();
|
|
||||||
$exprs
|
$exprs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! generate_custom_error_types {
|
macro_rules! generate_error_types {
|
||||||
{
|
{
|
||||||
$name: ident,
|
$name: ident,
|
||||||
$kindname: ident,
|
$kindname: ident,
|
||||||
$customMemberTypeName: ident,
|
|
||||||
$($kind:ident => $string:expr),*
|
$($kind:ident => $string:expr),*
|
||||||
} => {
|
} => {
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
error_chain! {
|
||||||
pub enum $kindname {
|
types {
|
||||||
$( $kind ),*
|
$name, $kindname, ResultExt, Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for $kindname {
|
links {
|
||||||
|
// None
|
||||||
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
|
}
|
||||||
let s = match *self {
|
|
||||||
$( $kindname::$kind => $string ),*
|
foreign_links {
|
||||||
};
|
// None
|
||||||
try!(write!(fmt, "{}", s));
|
}
|
||||||
Ok(())
|
|
||||||
}
|
errors {
|
||||||
|
$(
|
||||||
}
|
$kind {
|
||||||
|
description($string)
|
||||||
impl IntoError for $kindname {
|
display($string)
|
||||||
type Target = $name;
|
}
|
||||||
|
)*
|
||||||
fn into_error(self) -> Self::Target {
|
}
|
||||||
$name::new(self, None)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
|
|
||||||
$name::new(self, Some(cause))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct $name {
|
|
||||||
err_type: $kindname,
|
|
||||||
cause: Option<Box<Error>>,
|
|
||||||
custom_data: Option<$customMemberTypeName>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl $name {
|
|
||||||
|
|
||||||
pub fn new(errtype: $kindname, cause: Option<Box<Error>>) -> $name {
|
|
||||||
$name {
|
|
||||||
err_type: errtype,
|
|
||||||
cause: cause,
|
|
||||||
custom_data: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn err_type(&self) -> $kindname {
|
|
||||||
self.err_type
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn with_custom_data(mut self, custom: $customMemberTypeName) -> $name {
|
|
||||||
self.custom_data = Some(custom);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Into<$name> for $kindname {
|
|
||||||
|
|
||||||
fn into(self) -> $name {
|
|
||||||
$name::new(self, None)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for $name {
|
|
||||||
|
|
||||||
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
|
|
||||||
try!(write!(fmt, "[{}]", self.err_type));
|
|
||||||
match self.custom_data {
|
|
||||||
Some(ref c) => write!(fmt, "{}", c),
|
|
||||||
None => Ok(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Error for $name {
|
|
||||||
|
|
||||||
fn description(&self) -> &str {
|
|
||||||
match self.err_type {
|
|
||||||
$( $kindname::$kind => $string ),*
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cause(&self) -> Option<&Error> {
|
|
||||||
self.cause.as_ref().map(|e| &**e)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_result_helper!($name, $kindname);
|
||||||
|
generate_option_helper!($name, $kindname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! generate_result_helper {
|
macro_rules! generate_result_helper {
|
||||||
(
|
{
|
||||||
$name: ident,
|
$name:ident, $kindname:ident
|
||||||
$kindname: ident
|
} => {
|
||||||
) => {
|
|
||||||
/// Trait to replace
|
/// Trait to replace
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
|
@ -163,15 +80,14 @@ macro_rules! generate_result_helper {
|
||||||
/// foo.map_err_into(SomeType::SomeErrorKind)
|
/// foo.map_err_into(SomeType::SomeErrorKind)
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
pub trait MapErrInto<T> {
|
pub trait MapErrInto<T, E: Error> {
|
||||||
fn map_err_into(self, error_kind: $kindname) -> Result<T, $name>;
|
fn map_err_into(self, error_kind: $kindname) -> ::std::result::Result<T, E>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, E: Error + 'static> MapErrInto<T> for Result<T, E> {
|
impl<T, E: Error> MapErrInto<T, E: Error> for Result<T, E> {
|
||||||
|
|
||||||
fn map_err_into(self, error_kind: $kindname) -> Result<T, $name> {
|
fn map_err_into(self, error_kind: $kindname) -> ::std::result::Result<T, E> {
|
||||||
self.map_err(Box::new)
|
self.chain_err(|| error_kind)
|
||||||
.map_err(|e| error_kind.into_error_with_cause(e))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -180,10 +96,9 @@ macro_rules! generate_result_helper {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! generate_option_helper {
|
macro_rules! generate_option_helper {
|
||||||
(
|
{
|
||||||
$name: ident,
|
$name:ident, $kindname:ident
|
||||||
$kindname: ident
|
} => {
|
||||||
) => {
|
|
||||||
/// Trait to replace
|
/// Trait to replace
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
|
@ -196,193 +111,45 @@ macro_rules! generate_option_helper {
|
||||||
/// foo.ok_or_errkind(SomeType::SomeErrorKind)
|
/// foo.ok_or_errkind(SomeType::SomeErrorKind)
|
||||||
/// ```
|
/// ```
|
||||||
pub trait OkOrErr<T> {
|
pub trait OkOrErr<T> {
|
||||||
fn ok_or_errkind(self, kind: $kindname) -> Result<T, $name>;
|
fn ok_or_errkind(self, kind: $kindname) -> Result<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> OkOrErr<T> for Option<T> {
|
impl<T> OkOrErr<T> for Option<T> {
|
||||||
|
|
||||||
fn ok_or_errkind(self, kind: $kindname) -> Result<T, $name> {
|
fn ok_or_errkind(self, kind: $kindname) -> Result<T> {
|
||||||
self.ok_or(kind.into_error())
|
self.ok_or($name::from_kind(kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! generate_error_types {
|
|
||||||
(
|
|
||||||
$name: ident,
|
|
||||||
$kindname: ident,
|
|
||||||
$($kind:ident => $string:expr),*
|
|
||||||
) => {
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Copy)]
|
|
||||||
pub struct SomeNotExistingTypeWithATypeNameNoOneWillEverChoose {}
|
|
||||||
|
|
||||||
impl Display for SomeNotExistingTypeWithATypeNameNoOneWillEverChoose {
|
|
||||||
fn fmt(&self, _: &mut Formatter) -> Result<(), FmtError> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_custom_error_types!($name, $kindname,
|
|
||||||
SomeNotExistingTypeWithATypeNameNoOneWillEverChoose,
|
|
||||||
$($kind => $string),*);
|
|
||||||
|
|
||||||
generate_result_helper!($name, $kindname);
|
|
||||||
generate_option_helper!($name, $kindname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
||||||
generate_error_module!(
|
generate_error_types!(TestError, TestErrorKind,
|
||||||
generate_error_types!(TestError, TestErrorKind,
|
TestErrorKindA => "testerrorkind a",
|
||||||
TestErrorKindA => "testerrorkind a",
|
TestErrorKindB => "testerrorkind B");
|
||||||
TestErrorKindB => "testerrorkind B");
|
|
||||||
);
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Copy)]
|
|
||||||
pub struct CustomData {
|
|
||||||
pub test: i32,
|
|
||||||
pub othr: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for CustomData {
|
|
||||||
fn fmt(&self, _: &mut Formatter) -> Result<(), FmtError> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_error_imports!();
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
generate_custom_error_types!(CustomTestError, CustomTestErrorKind,
|
|
||||||
CustomData,
|
|
||||||
CustomErrorKindA => "customerrorkind a",
|
|
||||||
CustomErrorKindB => "customerrorkind B");
|
|
||||||
|
|
||||||
// Allow dead code here.
|
|
||||||
// We wrote this to show that custom test types can be implemented.
|
|
||||||
#[allow(dead_code)]
|
|
||||||
impl CustomTestError {
|
|
||||||
pub fn test(&self) -> i32 {
|
|
||||||
match self.custom_data {
|
|
||||||
Some(t) => t.test,
|
|
||||||
None => 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn bar(&self) -> i64 {
|
|
||||||
match self.custom_data {
|
|
||||||
Some(t) => t.othr,
|
|
||||||
None => 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_a() {
|
|
||||||
use self::error::{TestError, TestErrorKind};
|
|
||||||
|
|
||||||
let kind = TestErrorKind::TestErrorKindA;
|
|
||||||
assert_eq!(String::from("testerrorkind a"), format!("{}", kind));
|
|
||||||
|
|
||||||
let e = TestError::new(kind, None);
|
|
||||||
assert_eq!(String::from("[testerrorkind a]"), format!("{}", e));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_b() {
|
|
||||||
use self::error::{TestError, TestErrorKind};
|
|
||||||
|
|
||||||
let kind = TestErrorKind::TestErrorKindB;
|
|
||||||
assert_eq!(String::from("testerrorkind B"), format!("{}", kind));
|
|
||||||
|
|
||||||
let e = TestError::new(kind, None);
|
|
||||||
assert_eq!(String::from("[testerrorkind B]"), format!("{}", e));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_ab() {
|
|
||||||
use std::error::Error;
|
|
||||||
use self::error::{TestError, TestErrorKind};
|
|
||||||
|
|
||||||
let kinda = TestErrorKind::TestErrorKindA;
|
|
||||||
let kindb = TestErrorKind::TestErrorKindB;
|
|
||||||
assert_eq!(String::from("testerrorkind a"), format!("{}", kinda));
|
|
||||||
assert_eq!(String::from("testerrorkind B"), format!("{}", kindb));
|
|
||||||
|
|
||||||
let e = TestError::new(kinda, Some(Box::new(TestError::new(kindb, None))));
|
|
||||||
assert_eq!(String::from("[testerrorkind a]"), format!("{}", e));
|
|
||||||
assert_eq!(TestErrorKind::TestErrorKindA, e.err_type());
|
|
||||||
assert_eq!(String::from("[testerrorkind B]"), format!("{}", e.cause().unwrap()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod anothererrormod {
|
pub mod anothererrormod {
|
||||||
generate_error_imports!();
|
|
||||||
generate_error_types!(TestError, TestErrorKind,
|
generate_error_types!(TestError, TestErrorKind,
|
||||||
TestErrorKindA => "testerrorkind a",
|
TestErrorKindA => "testerrorkind a",
|
||||||
TestErrorKindB => "testerrorkind B");
|
TestErrorKindB => "testerrorkind B");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_other_a() {
|
|
||||||
use self::anothererrormod::{TestError, TestErrorKind};
|
|
||||||
|
|
||||||
let kind = TestErrorKind::TestErrorKindA;
|
|
||||||
assert_eq!(String::from("testerrorkind a"), format!("{}", kind));
|
|
||||||
|
|
||||||
let e = TestError::new(kind, None);
|
|
||||||
assert_eq!(String::from("[testerrorkind a]"), format!("{}", e));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_other_b() {
|
|
||||||
use self::anothererrormod::{TestError, TestErrorKind};
|
|
||||||
|
|
||||||
let kind = TestErrorKind::TestErrorKindB;
|
|
||||||
assert_eq!(String::from("testerrorkind B"), format!("{}", kind));
|
|
||||||
|
|
||||||
let e = TestError::new(kind, None);
|
|
||||||
assert_eq!(String::from("[testerrorkind B]"), format!("{}", e));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_other_ab() {
|
|
||||||
use std::error::Error;
|
|
||||||
use self::anothererrormod::{TestError, TestErrorKind};
|
|
||||||
|
|
||||||
let kinda = TestErrorKind::TestErrorKindA;
|
|
||||||
let kindb = TestErrorKind::TestErrorKindB;
|
|
||||||
assert_eq!(String::from("testerrorkind a"), format!("{}", kinda));
|
|
||||||
assert_eq!(String::from("testerrorkind B"), format!("{}", kindb));
|
|
||||||
|
|
||||||
let e = TestError::new(kinda, Some(Box::new(TestError::new(kindb, None))));
|
|
||||||
assert_eq!(String::from("[testerrorkind a]"), format!("{}", e));
|
|
||||||
assert_eq!(TestErrorKind::TestErrorKindA, e.err_type());
|
|
||||||
assert_eq!(String::from("[testerrorkind B]"), format!("{}", e.cause().unwrap()));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error_kind_mapping() {
|
fn test_error_kind_mapping() {
|
||||||
use std::io::{Error, ErrorKind};
|
use self::MapErrInto;
|
||||||
use self::error::MapErrInto;
|
use self::TestErrorKind;
|
||||||
use self::error::TestErrorKind;
|
|
||||||
|
|
||||||
let err : Result<(), _> = Err(Error::new(ErrorKind::Other, ""));
|
let err : Result<()> = Err(TestError::from_kind(TestErrorKind::TestErrorKindB));
|
||||||
let err : Result<(), _> = err.map_err_into(TestErrorKind::TestErrorKindA);
|
let err : Result<()> = err.map_err_into(TestErrorKind::TestErrorKindA);
|
||||||
|
|
||||||
assert!(err.is_err());
|
assert!(err.is_err());
|
||||||
let err = err.unwrap_err();
|
|
||||||
|
|
||||||
match err.err_type() {
|
match *err.unwrap_err().kind() {
|
||||||
TestErrorKind::TestErrorKindA => assert!(true),
|
TestErrorKind::TestErrorKindA => assert!(true),
|
||||||
_ => assert!(false),
|
_ => assert!(false),
|
||||||
}
|
}
|
||||||
|
@ -390,17 +157,16 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error_kind_double_mapping() {
|
fn test_error_kind_double_mapping() {
|
||||||
use std::io::{Error, ErrorKind};
|
use self::TestErrorKind;
|
||||||
use self::error::MapErrInto;
|
use std::error::Error;
|
||||||
use self::error::TestErrorKind;
|
|
||||||
|
|
||||||
let err : Result<(), _> = Err(Error::new(ErrorKind::Other, ""));
|
let err : Result<()> = Err(TestError::from_kind(TestErrorKind::TestErrorKindB));
|
||||||
let err : Result<(), _> = err.map_err_into(TestErrorKind::TestErrorKindA)
|
let err : Result<()> = err.map_err_into(TestErrorKind::TestErrorKindA)
|
||||||
.map_err_into(TestErrorKind::TestErrorKindB);
|
.map_err_into(TestErrorKind::TestErrorKindB);
|
||||||
|
|
||||||
assert!(err.is_err());
|
assert!(err.is_err());
|
||||||
let err = err.unwrap_err();
|
let err = err.unwrap_err();
|
||||||
match err.err_type() {
|
match *err.kind() {
|
||||||
TestErrorKind::TestErrorKindB => assert!(true),
|
TestErrorKind::TestErrorKindB => assert!(true),
|
||||||
_ => assert!(false),
|
_ => assert!(false),
|
||||||
}
|
}
|
||||||
|
@ -415,8 +181,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error_option_good() {
|
fn test_error_option_good() {
|
||||||
use self::error::OkOrErr;
|
use self::OkOrErr;
|
||||||
use self::error::TestErrorKind;
|
use self::TestErrorKind;
|
||||||
|
|
||||||
let something = Some(1);
|
let something = Some(1);
|
||||||
match something.ok_or_errkind(TestErrorKind::TestErrorKindA) {
|
match something.ok_or_errkind(TestErrorKind::TestErrorKindA) {
|
||||||
|
@ -427,8 +193,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error_option_bad() {
|
fn test_error_option_bad() {
|
||||||
use self::error::OkOrErr;
|
use self::OkOrErr;
|
||||||
use self::error::TestErrorKind;
|
use self::TestErrorKind;
|
||||||
|
|
||||||
let something : Option<i32> = None;
|
let something : Option<i32> = None;
|
||||||
match something.ok_or_errkind(TestErrorKind::TestErrorKindA) {
|
match something.ok_or_errkind(TestErrorKind::TestErrorKindA) {
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
extern crate ansi_term;
|
extern crate ansi_term;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
#[macro_use] extern crate error_chain;
|
||||||
|
|
||||||
pub mod into;
|
pub mod into;
|
||||||
pub mod error_gen;
|
pub mod error_gen;
|
||||||
pub mod trace;
|
pub mod trace;
|
||||||
|
|
|
@ -24,24 +24,42 @@ use std::ops::Deref;
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
use clap::App;
|
use clap::App;
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(ConfigError, ConfigErrorKind,
|
types {
|
||||||
TOMLParserError => "TOML Parsing error",
|
ConfigError, ConfigErrorKind, ResultExt, Result;
|
||||||
NoConfigFileFound => "No config file found",
|
}
|
||||||
|
|
||||||
ConfigOverrideError => "Config override error",
|
errors {
|
||||||
ConfigOverrideKeyNotAvailable => "Key not available",
|
TOMLParserError {
|
||||||
ConfigOverrideTypeNotMatching => "Configuration Type not matching"
|
description("TOML Parsing error")
|
||||||
|
display("TOML Parsing error")
|
||||||
|
}
|
||||||
|
|
||||||
);
|
NoConfigFileFound {
|
||||||
);
|
description("No config file found")
|
||||||
|
display("No config file found")
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigOverrideError {
|
||||||
|
description("Config override error")
|
||||||
|
display("Config override error")
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigOverrideKeyNotAvailable {
|
||||||
|
description("Key not available")
|
||||||
|
display("Key not available")
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigOverrideTypeNotMatching {
|
||||||
|
description("Configuration Type not matching")
|
||||||
|
display("Configuration Type not matching")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::{ConfigError, ConfigErrorKind, MapErrInto};
|
pub use self::error::{ConfigError, ConfigErrorKind, MapErrInto};
|
||||||
use libimagerror::into::IntoError;
|
use libimagerror::into::IntoError;
|
||||||
|
|
||||||
/// Result type of this module. Either `T` or `ConfigError`
|
|
||||||
pub type Result<T> = RResult<T, ConfigError>;
|
|
||||||
|
|
||||||
/// `Configuration` object
|
/// `Configuration` object
|
||||||
///
|
///
|
||||||
/// Holds all config variables which are globally available plus the configuration object from the
|
/// Holds all config variables which are globally available plus the configuration object from the
|
||||||
|
|
|
@ -17,99 +17,278 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_imports!();
|
error_chain! {
|
||||||
use std::convert::From;
|
types {
|
||||||
|
StoreError, StoreErrorKind, ResultExt, Result;
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Copy)]
|
|
||||||
pub struct CustomErrorData {}
|
|
||||||
|
|
||||||
impl Display for CustomErrorData {
|
|
||||||
fn fmt(&self, _: &mut Formatter) -> Result<(), FmtError> {
|
|
||||||
Ok(()) // Do nothing here, we don't need to print smth
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
generate_custom_error_types!(StoreError, StoreErrorKind, CustomErrorData,
|
errors {
|
||||||
ConfigurationError => "Store Configuration Error",
|
|
||||||
ConfigTypeError => "Store configuration type error",
|
|
||||||
ConfigKeyMissingError => "Configuration Key missing",
|
|
||||||
|
|
||||||
VersionError => "Incompatible store versions detected",
|
ConfigurationError {
|
||||||
|
description("Store Configuration Error")
|
||||||
|
display("Store Configuration Error")
|
||||||
|
}
|
||||||
|
|
||||||
CreateStoreDirDenied => "Creating store directory implicitely denied",
|
ConfigTypeError {
|
||||||
FileError => "File Error",
|
description("Store configuration type error")
|
||||||
IoError => "IO Error",
|
display("Store configuration type 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",
|
|
||||||
FileNotWritten => "File corresponding to ID could not be written to",
|
|
||||||
FileNotSeeked => "File corresponding to ID could not be seeked",
|
|
||||||
FileNotRemoved => "File corresponding to ID could not be removed",
|
|
||||||
FileNotRenamed => "File corresponding to ID could not be renamed",
|
|
||||||
FileNotCopied => "File could not be copied",
|
|
||||||
DirNotCreated => "Directory/Directories 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",
|
|
||||||
StorePathLacksVersion => "The supplied store path has no version part",
|
|
||||||
GlobError => "glob() error",
|
|
||||||
EncodingError => "Encoding error",
|
|
||||||
StorePathError => "Store Path error",
|
|
||||||
EntryRenameError => "Entry rename error",
|
|
||||||
StoreIdHandlingError => "StoreId handling error",
|
|
||||||
StoreIdLocalPartAbsoluteError => "StoreId 'id' part is absolute (starts with '/') which is not allowed",
|
|
||||||
StoreIdBuildFromFullPathError => "Building StoreId from full file path failed",
|
|
||||||
StoreIdHasNoBaseError => "StoreId has no 'base' part",
|
|
||||||
|
|
||||||
CreateCallError => "Error when calling create()",
|
ConfigKeyMissingError {
|
||||||
RetrieveCallError => "Error when calling retrieve()",
|
description("Configuration Key missing")
|
||||||
GetCallError => "Error when calling get()",
|
display("Configuration Key missing")
|
||||||
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()",
|
|
||||||
DeleteCallError => "Error when calling delete()",
|
|
||||||
MoveCallError => "Error when calling move()",
|
|
||||||
MoveByIdCallError => "Error when calling move_by_id()"
|
|
||||||
);
|
|
||||||
|
|
||||||
generate_result_helper!(StoreError, StoreErrorKind);
|
VersionError {
|
||||||
generate_option_helper!(StoreError, StoreErrorKind);
|
description("Incompatible store versions detected")
|
||||||
|
display("Incompatible store versions detected")
|
||||||
|
}
|
||||||
|
|
||||||
generate_custom_error_types!(ParserError, ParserErrorKind, CustomErrorData,
|
CreateStoreDirDenied {
|
||||||
TOMLParserErrors => "Several TOML-Parser-Errors",
|
description("Creating store directory implicitely denied")
|
||||||
MissingMainSection => "Missing main section",
|
display("Creating store directory implicitely denied")
|
||||||
MissingVersionInfo => "Missing version information in main section",
|
}
|
||||||
NonTableInBaseTable => "A non-table was found in the base table",
|
|
||||||
HeaderInconsistency => "The header is inconsistent"
|
|
||||||
);
|
|
||||||
|
|
||||||
impl From<ParserError> for StoreError {
|
FileError {
|
||||||
fn from(ps: ParserError) -> StoreError {
|
description("File Error")
|
||||||
StoreError {
|
display("File Error")
|
||||||
err_type: StoreErrorKind::MalformedEntry,
|
}
|
||||||
cause: Some(Box::new(ps)),
|
|
||||||
custom_data: None,
|
IoError {
|
||||||
}
|
description("IO Error")
|
||||||
}
|
display("IO Error")
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<::std::io::Error> for StoreError {
|
IdLocked {
|
||||||
fn from(ps: ::std::io::Error) -> StoreError {
|
description("ID locked")
|
||||||
StoreError {
|
display("ID locked")
|
||||||
err_type: StoreErrorKind::IoError,
|
}
|
||||||
cause: Some(Box::new(ps)),
|
|
||||||
custom_data: None,
|
IdNotFound {
|
||||||
|
description("ID not found")
|
||||||
|
display("ID not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
OutOfMemory {
|
||||||
|
description("Out of Memory")
|
||||||
|
display("Out of Memory")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotFound {
|
||||||
|
description("File corresponding to ID not found")
|
||||||
|
display("File corresponding to ID not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotCreated {
|
||||||
|
description("File corresponding to ID could not be created")
|
||||||
|
display("File corresponding to ID could not be created")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotWritten {
|
||||||
|
description("File corresponding to ID could not be written to")
|
||||||
|
display("File corresponding to ID could not be written to")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotSeeked {
|
||||||
|
description("File corresponding to ID could not be seeked")
|
||||||
|
display("File corresponding to ID could not be seeked")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotRemoved {
|
||||||
|
description("File corresponding to ID could not be removed")
|
||||||
|
display("File corresponding to ID could not be removed")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotRenamed {
|
||||||
|
description("File corresponding to ID could not be renamed")
|
||||||
|
display("File corresponding to ID could not be renamed")
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNotCopied {
|
||||||
|
description("File could not be copied")
|
||||||
|
display("File could not be copied")
|
||||||
|
}
|
||||||
|
|
||||||
|
DirNotCreated {
|
||||||
|
description("Directory/Directories could not be created")
|
||||||
|
display("Directory/Directories could not be created")
|
||||||
|
}
|
||||||
|
|
||||||
|
StorePathExists {
|
||||||
|
description("Store path exists")
|
||||||
|
display("Store path exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
StorePathCreate {
|
||||||
|
description("Store path create")
|
||||||
|
display("Store path create")
|
||||||
|
}
|
||||||
|
|
||||||
|
LockError {
|
||||||
|
description("Error locking datastructure")
|
||||||
|
display("Error locking datastructure")
|
||||||
|
}
|
||||||
|
|
||||||
|
LockPoisoned {
|
||||||
|
description("The internal Store Lock has been poisoned")
|
||||||
|
display("The internal Store Lock has been poisoned")
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryAlreadyBorrowed {
|
||||||
|
description("Entry is already borrowed")
|
||||||
|
display("Entry is already borrowed")
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryAlreadyExists {
|
||||||
|
description("Entry already exists")
|
||||||
|
display("Entry already exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
MalformedEntry {
|
||||||
|
description("Entry has invalid formatting, missing header")
|
||||||
|
display("Entry has invalid formatting, missing header")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderPathSyntaxError {
|
||||||
|
description("Syntax error in accessor string")
|
||||||
|
display("Syntax error in accessor string")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderPathTypeFailure {
|
||||||
|
description("Header has wrong type for path")
|
||||||
|
display("Header has wrong type for path")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderKeyNotFound {
|
||||||
|
description("Header Key not found")
|
||||||
|
display("Header Key not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderTypeFailure {
|
||||||
|
description("Header type is wrong")
|
||||||
|
display("Header type is wrong")
|
||||||
|
}
|
||||||
|
|
||||||
|
StorePathLacksVersion {
|
||||||
|
description("The supplied store path has no version part")
|
||||||
|
display("The supplied store path has no version part")
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobError {
|
||||||
|
description("glob() error")
|
||||||
|
display("glob() error")
|
||||||
|
}
|
||||||
|
|
||||||
|
EncodingError {
|
||||||
|
description("Encoding error")
|
||||||
|
display("Encoding error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StorePathError {
|
||||||
|
description("Store Path error")
|
||||||
|
display("Store Path error")
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryRenameError {
|
||||||
|
description("Entry rename error")
|
||||||
|
display("Entry rename error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdHandlingError {
|
||||||
|
description("StoreId handling error")
|
||||||
|
display("StoreId handling error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdLocalPartAbsoluteError {
|
||||||
|
description("StoreId 'id' part is absolute (starts with '/') which is not allowed")
|
||||||
|
display("StoreId 'id' part is absolute (starts with '/') which is not allowed")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdBuildFromFullPathError {
|
||||||
|
description("Building StoreId from full file path failed")
|
||||||
|
display("Building StoreId from full file path failed")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdHasNoBaseError {
|
||||||
|
description("StoreId has no 'base' part")
|
||||||
|
display("StoreId has no 'base' part")
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateCallError {
|
||||||
|
description("Error when calling create()")
|
||||||
|
display("Error when calling create()")
|
||||||
|
}
|
||||||
|
|
||||||
|
RetrieveCallError {
|
||||||
|
description("Error when calling retrieve()")
|
||||||
|
display("Error when calling retrieve()")
|
||||||
|
}
|
||||||
|
|
||||||
|
GetCallError {
|
||||||
|
description("Error when calling get()")
|
||||||
|
display("Error when calling get()")
|
||||||
|
}
|
||||||
|
|
||||||
|
GetAllVersionsCallError {
|
||||||
|
description("Error when calling get_all_versions()")
|
||||||
|
display("Error when calling get_all_versions()")
|
||||||
|
}
|
||||||
|
|
||||||
|
RetrieveForModuleCallError {
|
||||||
|
description("Error when calling retrieve_for_module()")
|
||||||
|
display("Error when calling retrieve_for_module()")
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateCallError {
|
||||||
|
description("Error when calling update()")
|
||||||
|
display("Error when calling update()")
|
||||||
|
}
|
||||||
|
|
||||||
|
RetrieveCopyCallError {
|
||||||
|
description("Error when calling retrieve_copy()")
|
||||||
|
display("Error when calling retrieve_copy()")
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteCallError {
|
||||||
|
description("Error when calling delete()")
|
||||||
|
display("Error when calling delete()")
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCallError {
|
||||||
|
description("Error when calling move()")
|
||||||
|
display("Error when calling move()")
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveByIdCallError {
|
||||||
|
description("Error when calling move_by_id()")
|
||||||
|
display("Error when calling move_by_id()")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parser-related errors
|
||||||
|
|
||||||
|
TOMLParserErrors {
|
||||||
|
description("Several TOML-Parser-Errors")
|
||||||
|
display("Several TOML-Parser-Errors")
|
||||||
|
}
|
||||||
|
|
||||||
|
MissingMainSection {
|
||||||
|
description("Missing main section")
|
||||||
|
display("Missing main section")
|
||||||
|
}
|
||||||
|
|
||||||
|
MissingVersionInfo {
|
||||||
|
description("Missing version information in main section")
|
||||||
|
display("Missing version information in main section")
|
||||||
|
}
|
||||||
|
|
||||||
|
NonTableInBaseTable {
|
||||||
|
description("A non-table was found in the base table")
|
||||||
|
display("A non-table was found in the base table")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderInconsistency {
|
||||||
|
description("The header is inconsistent")
|
||||||
|
display("The header is inconsistent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,39 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(BookmarkError, BookmarkErrorKind,
|
types {
|
||||||
StoreReadError => "Store read error",
|
BookmarkError, BookmarkErrorKind, ResultExt, Result;
|
||||||
LinkError => "Link error",
|
}
|
||||||
LinkParsingError => "Link parsing error",
|
|
||||||
LinkingError => "Error while linking",
|
errors {
|
||||||
CollectionNotFound => "Link-Collection not found"
|
StoreReadError {
|
||||||
);
|
description("Store read error")
|
||||||
);
|
display("Store read error")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkError {
|
||||||
|
description("Link error")
|
||||||
|
display("Link error")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkParsingError {
|
||||||
|
description("Link parsing error")
|
||||||
|
display("Link parsing error")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkingError {
|
||||||
|
description("Error while linking")
|
||||||
|
display("Error while linking")
|
||||||
|
}
|
||||||
|
|
||||||
|
CollectionNotFound {
|
||||||
|
description("Link-Collection not found")
|
||||||
|
display("Link-Collection not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::BookmarkError;
|
pub use self::error::BookmarkError;
|
||||||
pub use self::error::BookmarkErrorKind;
|
pub use self::error::BookmarkErrorKind;
|
||||||
|
|
|
@ -17,15 +17,39 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(CounterError, CounterErrorKind,
|
types {
|
||||||
StoreIdError => "StoreId error",
|
CounterError, CounterErrorKind, ResultExt, Result;
|
||||||
StoreReadError => "Store read error",
|
}
|
||||||
StoreWriteError => "Store write error",
|
|
||||||
HeaderTypeError => "Header type error",
|
errors {
|
||||||
HeaderFieldMissingError => "Header field missing error"
|
StoreIdError {
|
||||||
);
|
description("StoreId error")
|
||||||
);
|
display("StoreId error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreReadError {
|
||||||
|
description("Store read error")
|
||||||
|
display("Store read error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreWriteError {
|
||||||
|
description("Store write error")
|
||||||
|
display("Store write error")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderTypeError {
|
||||||
|
description("Header type error")
|
||||||
|
display("Header type error")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderFieldMissingError {
|
||||||
|
description("Header field missing error")
|
||||||
|
display("Header field missing error")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::CounterError;
|
pub use self::error::CounterError;
|
||||||
pub use self::error::CounterErrorKind;
|
pub use self::error::CounterErrorKind;
|
||||||
|
|
|
@ -17,20 +17,64 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(DiaryError, DiaryErrorKind,
|
types {
|
||||||
StoreWriteError => "Error writing store",
|
DiaryError, DiaryErrorKind, ResultExt, Result;
|
||||||
StoreReadError => "Error reading store",
|
}
|
||||||
CannotFindDiary => "Cannot find diary",
|
|
||||||
CannotCreateNote => "Cannot create Note object for diary entry",
|
errors {
|
||||||
DiaryEditError => "Cannot edit diary entry",
|
StoreWriteError {
|
||||||
PathConversionError => "Error while converting paths internally",
|
description("Error writing store")
|
||||||
EntryNotInDiary => "Entry not in Diary",
|
display("Error writing store")
|
||||||
IOError => "IO Error",
|
}
|
||||||
ViewError => "Error viewing diary entry",
|
|
||||||
IdParseError => "Error while parsing ID"
|
StoreReadError {
|
||||||
);
|
description("Error reading store")
|
||||||
);
|
display("Error reading store")
|
||||||
|
}
|
||||||
|
|
||||||
|
CannotFindDiary {
|
||||||
|
description("Cannot find diary")
|
||||||
|
display("Cannot find diary")
|
||||||
|
}
|
||||||
|
|
||||||
|
CannotCreateNote {
|
||||||
|
description("Cannot create Note object for diary entry")
|
||||||
|
display("Cannot create Note object for diary entry")
|
||||||
|
}
|
||||||
|
|
||||||
|
DiaryEditError {
|
||||||
|
description("Cannot edit diary entry")
|
||||||
|
display("Cannot edit diary entry")
|
||||||
|
}
|
||||||
|
|
||||||
|
PathConversionError {
|
||||||
|
description("Error while converting paths internally")
|
||||||
|
display("Error while converting paths internally")
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryNotInDiary {
|
||||||
|
description("Entry not in Diary")
|
||||||
|
display("Entry not in Diary")
|
||||||
|
}
|
||||||
|
|
||||||
|
IOError {
|
||||||
|
description("IO Error")
|
||||||
|
display("IO Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewError {
|
||||||
|
description("Error viewing diary entry")
|
||||||
|
display("Error viewing diary entry")
|
||||||
|
}
|
||||||
|
|
||||||
|
IdParseError {
|
||||||
|
description("Error while parsing ID")
|
||||||
|
display("Error while parsing ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::DiaryError;
|
pub use self::error::DiaryError;
|
||||||
pub use self::error::DiaryErrorKind;
|
pub use self::error::DiaryErrorKind;
|
||||||
|
|
|
@ -17,17 +17,31 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(MailError, MailErrorKind,
|
types {
|
||||||
RefCreationError => "Error creating a reference to a file/directory",
|
MailError, MailErrorKind, ResultExt, Result;
|
||||||
RefHandlingError => "Error while handling the internal reference object",
|
}
|
||||||
MailParsingError => "Error while parsing mail",
|
|
||||||
|
|
||||||
FetchByHashError => "Error fetching mail from Store by hash",
|
errors {
|
||||||
FetchError => "Error fetching mail from Store",
|
RefCreationError {
|
||||||
IOError => "IO Error"
|
description("Error creating a reference to a file/directory")
|
||||||
);
|
display("Error creating a reference to a file/directory")
|
||||||
);
|
}
|
||||||
|
|
||||||
|
FetchByHashError {
|
||||||
|
description("Error fetching mail from Store by hash")
|
||||||
|
display("Error fetching mail from Store by hash")
|
||||||
|
}
|
||||||
|
FetchError {
|
||||||
|
description("Error fetching mail from Store")
|
||||||
|
display("Error fetching mail from Store")
|
||||||
|
}
|
||||||
|
IOError {
|
||||||
|
description("IO Error")
|
||||||
|
display("IO Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::MailError;
|
pub use self::error::MailError;
|
||||||
pub use self::error::MailErrorKind;
|
pub use self::error::MailErrorKind;
|
||||||
|
|
|
@ -17,14 +17,34 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(NoteError, NoteErrorKind,
|
types {
|
||||||
StoreWriteError => "Error writing store",
|
NoteError, NoteErrorKind, ResultExt, Result;
|
||||||
StoreReadError => "Error reading store",
|
}
|
||||||
HeaderTypeError => "Header type error",
|
|
||||||
NoteToEntryConversion => "Error converting Note instance to Entry instance"
|
errors {
|
||||||
);
|
StoreWriteError {
|
||||||
);
|
description("Error writing store")
|
||||||
|
display("Error writing store")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreReadError {
|
||||||
|
description("Error reading store")
|
||||||
|
display("Error reading store")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderTypeError {
|
||||||
|
description("Header type error")
|
||||||
|
display("Header type error")
|
||||||
|
}
|
||||||
|
|
||||||
|
NoteToEntryConversion {
|
||||||
|
description("Error converting Note instance to Entry instance")
|
||||||
|
display("Error converting Note instance to Entry instance")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::NoteError;
|
pub use self::error::NoteError;
|
||||||
pub use self::error::NoteErrorKind;
|
pub use self::error::NoteErrorKind;
|
||||||
|
|
|
@ -17,21 +17,40 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(TimeTrackError, TimeTrackErrorKind,
|
types {
|
||||||
StoreReadError => "Store read error",
|
TimeTrackError, TimeTrackErrorKind, ResultExt, Result;
|
||||||
StoreWriteError => "Store write error",
|
}
|
||||||
|
|
||||||
StoreIdError => "Error while handling StoreId",
|
errors {
|
||||||
|
StoreIdError {
|
||||||
|
description("Error while handling StoreId")
|
||||||
|
display("Error while handling StoreId")
|
||||||
|
}
|
||||||
|
|
||||||
TagFormat => "Tag has invalid format",
|
TagFormat {
|
||||||
|
description("Tag has invalid format")
|
||||||
|
display("Tag has invalid format")
|
||||||
|
}
|
||||||
|
|
||||||
HeaderReadError => "Error writing header",
|
HeaderReadError {
|
||||||
HeaderWriteError => "Error writing header",
|
description("Error writing header")
|
||||||
HeaderFieldTypeError => "Type error in header",
|
display("Error writing header")
|
||||||
DateTimeParserError => "Error while parsing DateTime"
|
}
|
||||||
);
|
HeaderWriteError {
|
||||||
);
|
description("Error writing header")
|
||||||
|
display("Error writing header")
|
||||||
|
}
|
||||||
|
HeaderFieldTypeError {
|
||||||
|
description("Type error in header")
|
||||||
|
display("Type error in header")
|
||||||
|
}
|
||||||
|
DateTimeParserError {
|
||||||
|
description("Error while parsing DateTime")
|
||||||
|
display("Error while parsing DateTime")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::TimeTrackError;
|
pub use self::error::TimeTrackError;
|
||||||
pub use self::error::TimeTrackErrorKind;
|
pub use self::error::TimeTrackErrorKind;
|
||||||
|
|
|
@ -17,15 +17,39 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(TodoError, TodoErrorKind,
|
types {
|
||||||
ConversionError => "Conversion Error",
|
TodoError, TodoErrorKind, ResultExt, Result;
|
||||||
StoreError => "Store Error",
|
}
|
||||||
StoreIdError => "Store Id handling error",
|
|
||||||
ImportError => "Error importing",
|
errors {
|
||||||
UTF8Error => "Encountered non-UTF8 characters while reading input"
|
ConversionError {
|
||||||
);
|
description("Conversion Error"")
|
||||||
);
|
display("Conversion Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreError {
|
||||||
|
description("Store Error")
|
||||||
|
display("Store Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdError {
|
||||||
|
description("Store Id handling error")
|
||||||
|
display("Store Id handling error")
|
||||||
|
}
|
||||||
|
|
||||||
|
ImportError {
|
||||||
|
description("Error importing")
|
||||||
|
display("Error importing")
|
||||||
|
}
|
||||||
|
|
||||||
|
UTF8Error {
|
||||||
|
description("Encountered non-UTF8 characters while reading input)
|
||||||
|
display("Encountered non-UTF8 characters while reading input)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::TodoError;
|
pub use self::error::TodoError;
|
||||||
pub use self::error::TodoErrorKind;
|
pub use self::error::TodoErrorKind;
|
||||||
|
|
|
@ -17,17 +17,44 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(AnnotationError, AnnotationErrorKind,
|
types {
|
||||||
StoreReadError => "Store read error",
|
AnnotationError, AnnotationErrorKind, ResultExt, Result;
|
||||||
StoreWriteError => "Store write error",
|
}
|
||||||
|
|
||||||
LinkingError => "Error while linking",
|
errors {
|
||||||
HeaderWriteError => "Couldn't write Header for annotation",
|
StoreReadError {
|
||||||
HeaderReadError => "Couldn't read Header of Entry",
|
description("Store read error")
|
||||||
HeaderTypeError => "Header field has unexpected type"
|
display("Store read error")
|
||||||
);
|
}
|
||||||
);
|
|
||||||
|
StoreWriteError {
|
||||||
|
description("Store write error")
|
||||||
|
display("Store write error")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkingError {
|
||||||
|
description("Error while linking")
|
||||||
|
display("Error while linking")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderWriteError {
|
||||||
|
description("Couldn't write Header for annotation")
|
||||||
|
display("Couldn't write Header for annotation")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderReadError {
|
||||||
|
description("Couldn't read Header of Entry")
|
||||||
|
display("Couldn't read Header of Entry")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderTypeError {
|
||||||
|
description("Header field has unexpected type")
|
||||||
|
display("Header field has unexpected type")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::AnnotationError;
|
pub use self::error::AnnotationError;
|
||||||
pub use self::error::AnnotationErrorKind;
|
pub use self::error::AnnotationErrorKind;
|
||||||
|
|
|
@ -17,18 +17,38 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(CategoryError, CategoryErrorKind,
|
types {
|
||||||
StoreReadError => "Store Read error",
|
CategoryError, CategoryErrorKind, ResultExt, Result;
|
||||||
StoreWriteError => "Store Write error",
|
}
|
||||||
StoreIdHandlingError => "StoreId handling error",
|
|
||||||
HeaderReadError => "Header read error",
|
|
||||||
HeaderWriteError => "Header write error",
|
|
||||||
TypeError => "Found wrong type in header",
|
|
||||||
|
|
||||||
CategoryDoesNotExist => "Category does not exist"
|
errors {
|
||||||
);
|
StoreReadError {
|
||||||
);
|
description("Store Read error")
|
||||||
|
display("Store Read error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreWriteError {
|
||||||
|
description("Store Write error")
|
||||||
|
display("Store Write error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdHandlingError {
|
||||||
|
description("StoreId handling error")
|
||||||
|
display("StoreId handling error")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderReadError {
|
||||||
|
description("Header read error")
|
||||||
|
display("Header read error")
|
||||||
|
}
|
||||||
|
|
||||||
|
CategoryDoesNotExist {
|
||||||
|
description("Category does not exist")
|
||||||
|
display("Category does not exist")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::CategoryError;
|
pub use self::error::CategoryError;
|
||||||
pub use self::error::CategoryErrorKind;
|
pub use self::error::CategoryErrorKind;
|
||||||
|
|
|
@ -17,14 +17,23 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
/// Error module for the DatePathCompiler type
|
error_chain! {
|
||||||
generate_error_module! {
|
types {
|
||||||
generate_error_types!(DatePathCompilerError, DatePathCompilerErrorKind,
|
DatePathCompilerError, DatePathCompilerErrorKind, ResultExt, Result;
|
||||||
UnknownDatePathCompilerError => "Unknown DatePathCompiler error",
|
}
|
||||||
StoreIdBuildFailed => "Failed building StoreId object"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
pub use self::error::DatePathCompilerError;
|
|
||||||
pub use self::error::DatePathCompilerErrorKind;
|
|
||||||
pub use self::error::MapErrInto;
|
|
||||||
|
|
||||||
|
errors {
|
||||||
|
UnknownDatePathCompilerError {
|
||||||
|
description("Unknown DatePathCompiler error")
|
||||||
|
display("Unknown DatePathCompiler error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdBuildFailed {
|
||||||
|
description("Failed building StoreId object")
|
||||||
|
display("Failed building StoreId object")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub use self::error::DatePathCompilerError;
|
||||||
|
|
|
@ -17,21 +17,59 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(DateError, DateErrorKind,
|
types {
|
||||||
DeleteDateError => "Error deleting date",
|
DateError, DateErrorKind, ResultExt, Result;
|
||||||
ReadDateError => "Error reading date",
|
}
|
||||||
SetDateError => "Error setting date",
|
|
||||||
DeleteDateTimeRangeError => "Error deleting date-time range",
|
|
||||||
ReadDateTimeRangeError => "Error reading date-time range",
|
|
||||||
SetDateTimeRangeError => "Error setting date-time range",
|
|
||||||
|
|
||||||
DateTimeRangeError => "DateTime Range error",
|
errors {
|
||||||
|
DeleteDateError {
|
||||||
|
description("Error deleting date")
|
||||||
|
display("Error deleting date")
|
||||||
|
}
|
||||||
|
|
||||||
DateHeaderFieldTypeError => "Expected the header field in the entry to have type 'String', but have other type",
|
ReadDateError {
|
||||||
DateTimeParsingError => "Error parsing DateTime"
|
description("Error reading date")
|
||||||
);
|
display("Error reading date")
|
||||||
);
|
}
|
||||||
|
|
||||||
|
SetDateError {
|
||||||
|
description("Error setting date")
|
||||||
|
display("Error setting date")
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteDateTimeRangeError {
|
||||||
|
description("Error deleting date-time range")
|
||||||
|
display("Error deleting date-time range")
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadDateTimeRangeError {
|
||||||
|
description("Error reading date-time range")
|
||||||
|
display("Error reading date-time range")
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDateTimeRangeError {
|
||||||
|
description("Error setting date-time range")
|
||||||
|
display("Error setting date-time range")
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTimeRangeError {
|
||||||
|
description("DateTime Range error")
|
||||||
|
display("DateTime Range error")
|
||||||
|
}
|
||||||
|
|
||||||
|
DateHeaderFieldTypeError {
|
||||||
|
description("Expected the header field in the entry to have type 'String', but have other type")
|
||||||
|
display("Expected the header field in the entry to have type 'String', but have other type")
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTimeParsingError {
|
||||||
|
description("Error parsing DateTime")
|
||||||
|
display("Error parsing DateTime")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::DateError;
|
pub use self::error::DateError;
|
||||||
pub use self::error::DateErrorKind;
|
pub use self::error::DateErrorKind;
|
||||||
|
|
|
@ -18,25 +18,22 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
/// Error types for range module
|
/// Error types for range module
|
||||||
pub mod error {
|
error_chain! {
|
||||||
generate_error_module!(
|
types {
|
||||||
generate_error_types!(DateTimeRangeError, DateTimeRangeErrorKind,
|
DateTimeRangeError, DateTimeRangeErrorKind, ResultExt, Result;
|
||||||
EndDateTimeBeforeStartDateTime => "End datetime is before start datetime"
|
}
|
||||||
);
|
|
||||||
);
|
|
||||||
|
|
||||||
pub use self::error::DateTimeRangeError;
|
errors {
|
||||||
pub use self::error::DateTimeRangeErrorKind;
|
EndDateTimeBeforeStartDateTime {
|
||||||
pub use self::error::MapErrInto;
|
description("End datetime is before start datetime")
|
||||||
|
display("End datetime is before start datetime")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Result type for range module
|
pub use self::error::DateTimeRangeError;
|
||||||
pub mod result {
|
pub use self::error::DateTimeRangeErrorKind;
|
||||||
use std::result::Result as RResult;
|
pub use self::error::MapErrInto;
|
||||||
use super::error::DateTimeRangeError;
|
|
||||||
|
|
||||||
pub type Result<T> = RResult<T, DateTimeRangeError>;
|
|
||||||
}
|
|
||||||
|
|
||||||
use chrono::naive::NaiveDateTime;
|
use chrono::naive::NaiveDateTime;
|
||||||
use libimagerror::into::IntoError;
|
use libimagerror::into::IntoError;
|
||||||
|
|
|
@ -17,14 +17,34 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(EditError, EditErrorKind,
|
types {
|
||||||
IOError => "IO Error",
|
EditError, EditErrorKind, ResultExt, Result;
|
||||||
NoEditor => "No editor set",
|
}
|
||||||
ProcessExitFailure => "Process did not exit properly",
|
|
||||||
InstantiateError => "Instantation error"
|
errors {
|
||||||
);
|
IOError {
|
||||||
);
|
description("IO Error")
|
||||||
|
display("IO Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
NoEditor {
|
||||||
|
description("No editor set")
|
||||||
|
display("No editor set")
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessExitFailure {
|
||||||
|
description("Process did not exit properly")
|
||||||
|
display("Process did not exit properly")
|
||||||
|
}
|
||||||
|
|
||||||
|
InstantiateError {
|
||||||
|
description("Instantation error")
|
||||||
|
display("Instantation error")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::EditError;
|
pub use self::error::EditError;
|
||||||
pub use self::error::EditErrorKind;
|
pub use self::error::EditErrorKind;
|
||||||
|
|
|
@ -17,22 +17,74 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(LinkError, LinkErrorKind,
|
types {
|
||||||
EntryHeaderReadError => "Error while reading an entry header",
|
LinkError, LinkErrorKind, ResultExt, Result;
|
||||||
EntryHeaderWriteError => "Error while writing an entry header",
|
}
|
||||||
ExistingLinkTypeWrong => "Existing link entry has wrong type",
|
|
||||||
LinkTargetDoesNotExist => "Link target does not exist in the store",
|
errors {
|
||||||
LinkParserError => "Link cannot be parsed",
|
EntryHeaderReadError {
|
||||||
LinkParserFieldMissingError => "Link cannot be parsed: Field missing",
|
description("Error while reading an entry header")
|
||||||
LinkParserFieldTypeError => "Link cannot be parsed: Field type wrong",
|
display("Error while reading an entry header")
|
||||||
InternalConversionError => "Error while converting values internally",
|
}
|
||||||
InvalidUri => "URI is not valid",
|
|
||||||
StoreReadError => "Store read error",
|
EntryHeaderWriteError {
|
||||||
StoreWriteError => "Store write error",
|
description("Error while writing an entry header")
|
||||||
StoreIdError => "StoreId handling error"
|
display("Error while writing an entry header")
|
||||||
);
|
}
|
||||||
);
|
|
||||||
|
ExistingLinkTypeWrong {
|
||||||
|
description("Existing link entry has wrong type")
|
||||||
|
display("Existing link entry has wrong type")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkTargetDoesNotExist {
|
||||||
|
description("Link target does not exist in the store")
|
||||||
|
display("Link target does not exist in the store")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkParserError {
|
||||||
|
description("Link cannot be parsed")
|
||||||
|
display("Link cannot be parsed")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkParserFieldMissingError {
|
||||||
|
description("Link cannot be parsed: Field missing")
|
||||||
|
display("Link cannot be parsed: Field missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkParserFieldTypeError {
|
||||||
|
description("Link cannot be parsed: Field type wrong")
|
||||||
|
display("Link cannot be parsed: Field type wrong")
|
||||||
|
}
|
||||||
|
|
||||||
|
InternalConversionError {
|
||||||
|
description("Error while converting values internally")
|
||||||
|
display("Error while converting values internally")
|
||||||
|
}
|
||||||
|
|
||||||
|
InvalidUri {
|
||||||
|
description("URI is not valid")
|
||||||
|
display("URI is not valid")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreReadError {
|
||||||
|
description("Store read error")
|
||||||
|
display("Store read error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreWriteError {
|
||||||
|
description("Store write error")
|
||||||
|
display("Store write error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdError {
|
||||||
|
description("StoreId handling error")
|
||||||
|
display("StoreId handling error")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::LinkError;
|
pub use self::error::LinkError;
|
||||||
pub use self::error::LinkErrorKind;
|
pub use self::error::LinkErrorKind;
|
||||||
|
|
|
@ -17,15 +17,39 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(ListError, ListErrorKind,
|
types {
|
||||||
IOError => "IO Error",
|
ListError, ListErrorKind, ResultExt, Result;
|
||||||
FormatError => "FormatError",
|
}
|
||||||
EntryError => "EntryError",
|
|
||||||
IterationError => "IterationError",
|
errors {
|
||||||
CLIError => "No CLI subcommand for listing entries"
|
IOError {
|
||||||
);
|
description("IO Error")
|
||||||
);
|
display("IO Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
FormatError {
|
||||||
|
description("FormatError")
|
||||||
|
display("FormatError")
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryError {
|
||||||
|
description("EntryError")
|
||||||
|
display("EntryError")
|
||||||
|
}
|
||||||
|
|
||||||
|
IterationError {
|
||||||
|
description("IterationError")
|
||||||
|
display("IterationError")
|
||||||
|
}
|
||||||
|
|
||||||
|
CLIError {
|
||||||
|
description("No CLI subcommand for listing entries")
|
||||||
|
display("No CLI subcommand for listing entries")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::ListError;
|
pub use self::error::ListError;
|
||||||
pub use self::error::ListErrorKind;
|
pub use self::error::ListErrorKind;
|
||||||
|
|
|
@ -17,12 +17,24 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(MarkdownError, MarkdownErrorKind,
|
types {
|
||||||
MarkdownRenderError => "Markdown render error",
|
MarkdownError, MarkdownErrorKind, ResultExt, Result;
|
||||||
LinkParsingError => "Link parsing error"
|
}
|
||||||
);
|
|
||||||
);
|
errors {
|
||||||
|
MarkdownRenderError {
|
||||||
|
description("Markdown render error")
|
||||||
|
display("Markdown render error")
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkParsingError {
|
||||||
|
description("Link parsing error")
|
||||||
|
display("Link parsing error")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::MarkdownError;
|
pub use self::error::MarkdownError;
|
||||||
pub use self::error::MarkdownErrorKind;
|
pub use self::error::MarkdownErrorKind;
|
||||||
|
|
|
@ -17,37 +17,129 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(RefError, RefErrorKind,
|
types {
|
||||||
StoreReadError => "Store read error",
|
RefError, RefErrorKind, ResultExt, Result;
|
||||||
StoreWriteError => "Store write error",
|
}
|
||||||
IOError => "IO Error",
|
|
||||||
UTF8Error => "UTF8 Error",
|
|
||||||
StoreIdError => "Error with storeid",
|
|
||||||
HeaderTomlError => "Error while working with TOML Header",
|
|
||||||
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",
|
errors {
|
||||||
RefToDisplayError => "Cannot convert Ref to string to show it to user",
|
StoreReadError {
|
||||||
|
description("Store read error")
|
||||||
|
display("Store read error")
|
||||||
|
}
|
||||||
|
|
||||||
RefNotInStore => "Ref/StoreId does not exist in store",
|
StoreWriteError {
|
||||||
|
description("Store write error")
|
||||||
|
display("Store write error")
|
||||||
|
}
|
||||||
|
|
||||||
RefTargetDoesNotExist => "Ref Target does not exist",
|
IOError {
|
||||||
RefTargetPermissionError => "Ref Target permissions insufficient for referencing",
|
description("IO Error")
|
||||||
RefTargetCannotBeHashed => "Ref Target cannot be hashed (is it a directory?)",
|
display("IO Error")
|
||||||
RefTargetFileCannotBeOpened => "Ref Target File cannot be open()ed",
|
}
|
||||||
RefTargetCannotReadPermissions => "Ref Target: Cannot read permissions",
|
|
||||||
|
|
||||||
RefHashingError => "Error while hashing"
|
UTF8Error {
|
||||||
);
|
description("UTF8 Error")
|
||||||
);
|
display("UTF8 Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdError {
|
||||||
|
description("Error with storeid")
|
||||||
|
display("Error with storeid")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderTomlError {
|
||||||
|
description("Error while working with TOML Header")
|
||||||
|
display("Error while working with TOML Header")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderTypeError {
|
||||||
|
description("Header type error")
|
||||||
|
display("Header type error")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderFieldMissingError {
|
||||||
|
description("Header field missing error")
|
||||||
|
display("Header field missing error")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderFieldWriteError {
|
||||||
|
description("Header field cannot be written")
|
||||||
|
display("Header field cannot be written")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderFieldReadError {
|
||||||
|
description("Header field cannot be read")
|
||||||
|
display("Header field cannot be read")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderFieldAlreadyExistsError {
|
||||||
|
description("Header field already exists, cannot override")
|
||||||
|
display("Header field already exists, cannot override")
|
||||||
|
}
|
||||||
|
|
||||||
|
PathUTF8Error {
|
||||||
|
description("Path cannot be converted because of UTF8 Error")
|
||||||
|
display("Path cannot be converted because of UTF8 Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
PathHashingError {
|
||||||
|
description("Path cannot be hashed")
|
||||||
|
display("Path cannot be hashed")
|
||||||
|
}
|
||||||
|
|
||||||
|
PathCanonicalizationError {
|
||||||
|
description("Path cannot be canonicalized")
|
||||||
|
display("Path cannot be canonicalized")
|
||||||
|
}
|
||||||
|
|
||||||
|
TypeConversionError {
|
||||||
|
description("Couldn't convert types")
|
||||||
|
display("Couldn't convert types")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefToDisplayError {
|
||||||
|
description("Cannot convert Ref to string to show it to user")
|
||||||
|
display("Cannot convert Ref to string to show it to user")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefNotInStore {
|
||||||
|
description("Ref/StoreId does not exist in store")
|
||||||
|
display("Ref/StoreId does not exist in store")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefTargetDoesNotExist {
|
||||||
|
description("Ref Target does not exist")
|
||||||
|
display("Ref Target does not exist")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefTargetPermissionError {
|
||||||
|
description("Ref Target permissions insufficient for referencing")
|
||||||
|
display("Ref Target permissions insufficient for referencing")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefTargetCannotBeHashed {
|
||||||
|
description("Ref Target cannot be hashed (is it a directory?)")
|
||||||
|
display("Ref Target cannot be hashed (is it a directory?)")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefTargetFileCannotBeOpened {
|
||||||
|
description("Ref Target File cannot be open()ed")
|
||||||
|
display("Ref Target File cannot be open()ed")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefTargetCannotReadPermissions {
|
||||||
|
description("Ref Target: Cannot read permissions")
|
||||||
|
display("Ref Target: Cannot read permissions")
|
||||||
|
}
|
||||||
|
|
||||||
|
RefHashingError {
|
||||||
|
description("Error while hashing")
|
||||||
|
display("Error while hashing")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::RefError;
|
pub use self::error::RefError;
|
||||||
pub use self::error::RefErrorKind;
|
pub use self::error::RefErrorKind;
|
||||||
|
|
|
@ -17,14 +17,34 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(TagError, TagErrorKind,
|
types {
|
||||||
TagTypeError => "Entry Header Tag Type wrong",
|
TagError, TagErrorKind, ResultExt, Result;
|
||||||
HeaderReadError => "Error while reading entry header",
|
}
|
||||||
HeaderWriteError => "Error while writing entry header",
|
|
||||||
NotATag => "String is not a tag"
|
errors {
|
||||||
);
|
TagTypeError {
|
||||||
);
|
description("Entry Header Tag Type wrong")
|
||||||
|
display("Entry Header Tag Type wrong")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderReadError {
|
||||||
|
description("Error while reading entry header")
|
||||||
|
display("Error while reading entry header")
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderWriteError {
|
||||||
|
description("Error while writing entry header")
|
||||||
|
display("Error while writing entry header")
|
||||||
|
}
|
||||||
|
|
||||||
|
NotATag {
|
||||||
|
description("String is not a tag")
|
||||||
|
display("String is not a tag")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::TagError;
|
pub use self::error::TagError;
|
||||||
pub use self::error::TagErrorKind;
|
pub use self::error::TagErrorKind;
|
||||||
|
|
|
@ -17,15 +17,39 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(ViewError, ViewErrorKind,
|
types {
|
||||||
Unknown => "Unknown view error",
|
ViewError, ViewErrorKind, ResultExt, Result;
|
||||||
GlobError => "Error while glob()ing",
|
}
|
||||||
PatternError => "Error in glob() pattern",
|
|
||||||
PatternBuildingError => "Could not build glob() pattern",
|
errors {
|
||||||
ViewError => "Failed to start viewer"
|
Unknown {
|
||||||
);
|
description("Unknown view error")
|
||||||
);
|
display("Unknown view error")
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobError {
|
||||||
|
description("Error while glob()ing")
|
||||||
|
display("Error while glob()ing")
|
||||||
|
}
|
||||||
|
|
||||||
|
PatternError {
|
||||||
|
description("Error in glob() pattern")
|
||||||
|
display("Error in glob() pattern")
|
||||||
|
}
|
||||||
|
|
||||||
|
PatternBuildingError {
|
||||||
|
description("Could not build glob() pattern")
|
||||||
|
display("Could not build glob() pattern")
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewError {
|
||||||
|
description("Failed to start viewer")
|
||||||
|
display("Failed to start viewer")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::ViewError;
|
pub use self::error::ViewError;
|
||||||
pub use self::error::ViewErrorKind;
|
pub use self::error::ViewErrorKind;
|
||||||
|
|
|
@ -17,21 +17,69 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
generate_error_module!(
|
error_chain! {
|
||||||
generate_error_types!(InteractionError, InteractionErrorKind,
|
types {
|
||||||
Unknown => "Unknown Error",
|
InteractionError, InteractionErrorKind, ResultExt, Result;
|
||||||
CLIError => "Error on commandline",
|
}
|
||||||
IdMissingError => "Commandline: ID missing",
|
|
||||||
StoreIdParsingError => "Error while parsing StoreId",
|
errors {
|
||||||
IdSelectingError => "Error while selecting id",
|
Unknown {
|
||||||
ConfigError => "Configuration error",
|
description("Unknown Error")
|
||||||
ConfigMissingError => "Configuration missing",
|
display("Unknown Error")
|
||||||
ConfigTypeError => "Config Type Error",
|
}
|
||||||
NoConfigError => "No configuration",
|
|
||||||
ReadlineHistoryFileCreationError => "Could not create history file for readline",
|
CLIError {
|
||||||
ReadlineError => "Readline error"
|
description("Error on commandline")
|
||||||
);
|
display("Error on commandline")
|
||||||
);
|
}
|
||||||
|
|
||||||
|
IdMissingError {
|
||||||
|
description("Commandline: ID missing")
|
||||||
|
display("Commandline: ID missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
StoreIdParsingError {
|
||||||
|
description("Error while parsing StoreId")
|
||||||
|
display("Error while parsing StoreId")
|
||||||
|
}
|
||||||
|
|
||||||
|
IdSelectingError {
|
||||||
|
description("Error while selecting id")
|
||||||
|
display("Error while selecting id")
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigError {
|
||||||
|
description("Configuration error")
|
||||||
|
display("Configuration error")
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigMissingError {
|
||||||
|
description("Configuration missing")
|
||||||
|
display("Configuration missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigTypeError {
|
||||||
|
description("Config Type Error")
|
||||||
|
display("Config Type Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
NoConfigError {
|
||||||
|
description("No configuration")
|
||||||
|
display("No configuration")
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadlineHistoryFileCreationError {
|
||||||
|
description("Could not create history file for readline")
|
||||||
|
display("Could not create history file for readline")
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadlineError {
|
||||||
|
description("Readline error")
|
||||||
|
display("Readline error")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub use self::error::InteractionError;
|
pub use self::error::InteractionError;
|
||||||
pub use self::error::InteractionErrorKind;
|
pub use self::error::InteractionErrorKind;
|
||||||
|
|
Loading…
Reference in a new issue