@@ -14,31 +14,32 @@ pub enum Error {
14
14
use self :: Error :: * ;
15
15
16
16
impl StdError for Error {
17
- fn description ( & self ) -> & str {
17
+ fn source ( & self ) -> Option < & ( dyn StdError + ' static ) > {
18
18
match * self {
19
- Io ( ref io_error) => io_error. description ( ) ,
20
- ExitEarly => "" ,
19
+ Io ( ref io_error) => Some ( io_error) ,
20
+ _ => None ,
21
+ }
22
+ }
23
+ }
24
+
25
+ impl Display for Error {
26
+ fn fmt ( & self , f : & mut Formatter ) -> Result < ( ) , FmtError > {
27
+ match * self {
28
+ Io ( ref io_error) => io_error. fmt ( f) ,
29
+ ExitEarly => Ok ( ( ) ) ,
21
30
GitInstallationError => {
22
- "Unable to execute 'git' on your machine, please make sure it's installed and on \
23
- your PATH"
31
+ write ! ( f, "Unable to execute 'git' on your machine, please make sure it's installed and on your PATH" )
24
32
}
25
33
CurrentBranchInvalidError => {
26
- "Please make sure to run git-clean from your base branch (defaults to master)."
34
+ write ! ( f , "Please make sure to run git-clean from your base branch (defaults to master)." )
27
35
}
28
36
InvalidRemoteError => {
29
- "That remote doesn't exist, please make sure to use a valid remote (defaults to \
30
- origin)."
37
+ write ! ( f, "That remote doesn't exist, please make sure to use a valid remote (defaults to origin)." )
31
38
}
32
39
}
33
40
}
34
41
}
35
42
36
- impl Display for Error {
37
- fn fmt ( & self , f : & mut Formatter ) -> Result < ( ) , FmtError > {
38
- self . description ( ) . fmt ( f)
39
- }
40
- }
41
-
42
43
impl From < IoError > for Error {
43
44
fn from ( error : IoError ) -> Error {
44
45
Io ( error)
0 commit comments