Created
          November 28, 2011 20:05 
        
      - 
      
- 
        Save codereflection/1401802 to your computer and use it in GitHub Desktop. 
    I don't like this pattern of throwing exceptions
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public DirectoryInfo GetDestinationFor(string fileName) | |
| { | |
| Log.InfoFormat("Getting destination for {0}", fileName); | |
| var result = paths.FirstOrDefault(x => x.Key.IsMatch(fileName)); | |
| if (result.Key != null) | |
| { | |
| Log.InfoFormat("Destination for {0} is {1}", fileName, result.Value); | |
| return result.Value; | |
| } | |
| throw new FileDestinationPickerException(string.Format("Cannot find destination for '{0}'", fileName)); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment