title: Custom error message of re-thrown exception not printed by what()
body: <p>I'm writing a set of custom exceptions that extend <code>std::exception</code>. In some code, when an exception is caught, I just re-<code>throw</code> it up the chain until the driver <code>main</code> function call <code>catch</code>es and prints the result. However, ultimately all that gets printed is "std::exception". This doesn't appear the be the <a href="https://stackoverflow.com/questions/42532341/exception-extends-stdexception-but-error-message-wont-print">scope issue</a> I dealt with previously. </p>
  
  <p><strong>Why are my exception messages not printing?</strong></p>
  
  <p>My exception code:</p>
  
  <pre><code>// General exception class
  struct MyException : public std::exception
  {
      std::string _msg;
  
      MyException(const std::string &amp;exception_name) : _msg(exception_name) {}
  
      void setMessage(const std::string &amp;message)
      {
          _msg += ": " + message + "\n";
      }
  
      void setLocation(const char * func, const char * file, const int line)
      {
          _msg += "  In function " + std::string(func) + "(" + file + ":" + std::to_string(line) + ")";
      }
  
      const char * what() const throw()
      {
          return _msg.c_str();
      }
  };
  
  // Specializations of the MyException
  struct FileNotFoundException : public MyException
  {
      FileNotFoundException() : MyException("FileNotFoundException") {}
  };
  
  struct IOException : public MyException
  {
      IOException() : MyException("IOException") {}
  };
  struct DBException : public MyException
  {
      DBException() : MyException("DBException") {}
  };
  </code></pre>
  
  <p>All of my exception throws are wrapped in this macro</p>
  
  <pre><code>#define EXCEPTION_THROWER(ET, message)              \
      {                           \
          ET e;                       \
          e.setMessage(message);              \
          e.setLocation(__func__, __FILE__, __LINE__);    \
          throw e;                    \
      }
  </code></pre>
  
  <p>and called as</p>
  
  <pre><code>EXCEPTION_THROWER(DBException, "Blah blah database exception")
  </code></pre>
  
  <p>The intermediate try/catch blocks look like this:</p>
  
  <pre><code>try
  {
      // Call a function that throws an exception
  }
  catch(const std::exception &amp;e)
  {
      throw e; // Forward any exceptions
  }
  </code></pre>
  
  <p>and the driver code is all in one <code>try</code> block with a <code>catch (const std::exception &amp;e)</code> block.</p>