title: Mixing errors and exceptions in C#
body: <p>I have looked, but couldn't find a definitive answer for some of my exception questions, especially regarding C# best practices.</p>
  
  <p>Perhaps I will always be confused about the best way to use exceptions, I ran across this article which basically says 'always use exceptions, never use error codes or properties' <a href="http://www.eggheadcafe.com/articles/20060612.asp" rel="noreferrer">http://www.eggheadcafe.com/articles/20060612.asp</a>.  I'll definitely buy that, but here's my dilemma:</p>
  
  <p>I have a function 'caller' which calls 'callee'.  'callee' performs a few different things, each of which might throw the same type of exception.  How do I relay meaningful information back to 'caller' about what 'callee' was doing at the time of the exception?</p>
  
  <p>I could throw a new exception like below, but I'm worried I'll mess up the stacktrace which is bad:  </p>
  
  <pre><code>//try to log in and get SomeException  
  catch(SomeException ex)
  {
    throw new SomeException("Login failed", ex);
  }
  
  ...
  
  //try to send a file and get SomeException
  catch(SomeException ex)
  {
      throw new SomeException("Sending file failed", ex):
  }
  </code></pre>
  
  <p>Thanks, Mark</p>