@@ -33,6 +33,7 @@ use std::io::prelude::*;
3333use std:: io;
3434use std:: path:: { self , Path , PathBuf , Component } ;
3535use std:: str:: FromStr ;
36+ use std:: error:: Error ;
3637
3738use PatternToken :: { Char , AnyChar , AnySequence , AnyRecursiveSequence , AnyWithin } ;
3839use PatternToken :: AnyExcept ;
@@ -230,6 +231,15 @@ impl GlobError {
230231 pub fn error ( & self ) -> & io:: Error { & self . error }
231232}
232233
234+ impl Error for GlobError {
235+ fn description ( & self ) -> & str {
236+ self . error . description ( )
237+ }
238+ fn cause ( & self ) -> Option < & Error > {
239+ Some ( & self . error )
240+ }
241+ }
242+
233243impl fmt:: Display for GlobError {
234244 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
235245 write ! ( f, "attempting to read `{}` resulted in an error: {}" ,
@@ -353,6 +363,12 @@ pub struct PatternError {
353363 pub msg : & ' static str ,
354364}
355365
366+ impl Error for PatternError {
367+ fn description ( & self ) -> & str {
368+ self . msg
369+ }
370+ }
371+
356372impl fmt:: Display for PatternError {
357373 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
358374 write ! ( f, "Pattern syntax error near position {}: {}" ,
0 commit comments