blob: a03cd1358a3f8c5454807a749a938ecf2cce8746 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
use std::convert::From;
use std::io;
#[derive(Clone, Debug)]
pub enum JoshutoErrorKind {
// io related
Io(io::ErrorKind),
// environment variable not found
EnvVarNotPresent,
// parse error
ParseError,
ClipboardError,
TomlDeError(toml::de::Error),
TrashError,
Glob,
InvalidParameters,
UnrecognizedArgument,
UnrecognizedCommand,
}
impl From<io::ErrorKind> for JoshutoErrorKind {
fn from(err: io::ErrorKind) -> Self {
Self::Io(err)
}
}
impl From<&globset::ErrorKind> for JoshutoErrorKind {
fn from(_: &globset::ErrorKind) -> Self {
Self::Glob
}
}
impl From<std::env::VarError> for JoshutoErrorKind {
fn from(_: std::env::VarError) -> Self {
Self::EnvVarNotPresent
}
}
impl From<toml::de::Error> for JoshutoErrorKind {
fn from(err: toml::de::Error) -> Self {
Self::TomlDeError(err)
}
}
|