title: Best Practices for handling Error Strings
body: <p>In my vb.net application if I have a known set of Error Strings i.e.</p>
  
  <ul>
  <li>Failed because I don't know about it   </li>
  <li>Failed because I know about it but I can't find it</li>
  <li>Failed for another reason</li>
  <li>etc</li>
  </ul>
  
  <p>And I get a response which I want to ensure doesn't have the error string in it</p>
  
  <pre><code>If returnedString.equals("Failed because I don't know about it") then 
      'do something'
  End if
  </code></pre>
  
  <p>How would people best suggest I get away from hardcoding the error string. </p>
  
  <p>Ideally a enumeration could have been be used here but wouldn't work in comparing the returned error string. (please correct me if I am wrong on this!) </p>
  
  <p>Are these best held as strings in the resource file or is best to have an ErrorClass with shared public propertys for each error string and check </p>
  
  <pre><code>If returnedErrorString.equals(ErrorClass.UnknownString) then 
          'do something'
  End if
  </code></pre>
  
  <p>Or is there any other (better?) way to do this?</p>
  
  <p>EDIT: The Exception suggestions I think would not be best in this situation as the returned error code doesn't necessarily cause the application to fail but will perhaps alter program flow as in what to display to the user and I have to look at the error strings as these are out with my control and returned from an external application</p>