Add HookErrorKind enums for Pre and Post errors
This commit is contained in:
parent
d7733aa13a
commit
57831dceb0
1 changed files with 25 additions and 1 deletions
|
@ -94,15 +94,39 @@ pub mod error {
|
||||||
use std::fmt::Error as FmtError;
|
use std::fmt::Error as FmtError;
|
||||||
use std::clone::Clone;
|
use std::clone::Clone;
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
|
use std::convert::Into;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kind of error
|
* Kind of error
|
||||||
*/
|
*/
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum HookErrorKind {
|
pub enum HookErrorKind {
|
||||||
|
Pre(PreHookErrorKind),
|
||||||
|
Post(PostHookErrorKind)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
pub enum PreHookErrorKind {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Into<HookErrorKind> for PreHookErrorKind {
|
||||||
|
fn into(self) -> HookErrorKind {
|
||||||
|
HookErrorKind::Pre(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
pub enum PostHookErrorKind {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<HookErrorKind> for PostHookErrorKind {
|
||||||
|
fn into(self) -> HookErrorKind {
|
||||||
|
HookErrorKind::Post(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn hook_error_type_as_str(e: &HookErrorKind) -> &'static str {
|
fn hook_error_type_as_str(e: &HookErrorKind) -> &'static str {
|
||||||
match e {
|
match e {
|
||||||
_ => "",
|
_ => "",
|
||||||
|
|
Loading…
Reference in a new issue