how about 
```raise NoSuchFileError.new(err.message) if NoSuchFileError.detected?(err.message)```