title: Custom Exceptions in C++
body: <p>I've been trying to make some custom exception classes for a C++ library I'm working on. These custom exceptions capture extra info, such as file,line number,etc, needed for debugging, if for some reason while testing an exception is not caught in the right place. However most people seem to recommend inheriting from the std::exception class in the STL, which I agree with, but I was wondering maybe it would be better to use multiple inheritance to inherit from each of the <a href="http://www.aoc.nrao.edu/~tjuerges/ALMA/STL/html/classstd_1_1exception.html" rel="noreferrer">derived std::exception classes</a> (eg. std::runtime_error) and a custom exception class, as in the code below?</p>
  
  <p>Another thing, how does one go about copy constructors and assignment operators in exception classes? Should they be disabled?</p>
  
  <pre><code>class Exception{
      public:
          explicit Exception(const char *origin, const char *file, 
                             const int line, const char *reason="", 
                             const int errno=0) throw();
  
          virtual ~Exception() throw();
  
          virtual const char* PrintException(void) throw();
  
          virtual int GetErrno(void);
  
      protected:
          std::string m_origin;
          std::string m_file;
          int m_line;
          std::string m_reason;
          int m_errno;
  }; 
  
  class RuntimeError: public virtual std::runtime_error, public Exception{
      public:
                explicit RuntimeError(const char *origin, const char *file, 
                                      const int line, const char *reason="", 
                                      const int errno=0) throw();
          virtual ~RuntimeError() throw();
  };
  </code></pre>