@@ -33,6 +33,7 @@ use std::io::prelude::*;
33
33
use std:: io;
34
34
use std:: path:: { self , Path , PathBuf , Component } ;
35
35
use std:: str:: FromStr ;
36
+ use std:: error:: Error ;
36
37
37
38
use PatternToken :: { Char , AnyChar , AnySequence , AnyRecursiveSequence , AnyWithin } ;
38
39
use PatternToken :: AnyExcept ;
@@ -230,6 +231,15 @@ impl GlobError {
230
231
pub fn error ( & self ) -> & io:: Error { & self . error }
231
232
}
232
233
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
+
233
243
impl fmt:: Display for GlobError {
234
244
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
235
245
write ! ( f, "attempting to read `{}` resulted in an error: {}" ,
@@ -353,6 +363,12 @@ pub struct PatternError {
353
363
pub msg : & ' static str ,
354
364
}
355
365
366
+ impl Error for PatternError {
367
+ fn description ( & self ) -> & str {
368
+ self . msg
369
+ }
370
+ }
371
+
356
372
impl fmt:: Display for PatternError {
357
373
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
358
374
write ! ( f, "Pattern syntax error near position {}: {}" ,
0 commit comments