]> git.lyx.org Git - lyx.git/blobdiff - src/support/ExceptionMessage.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / support / ExceptionMessage.h
index dc597c6547cf6d97ac69fc8e8d9bfbeff27b123a..347c7024f2bad15b4de0bcad67e0719654052672 100644 (file)
@@ -25,6 +25,7 @@ namespace support {
 
 enum ExceptionType {
        ErrorException,
+       BufferException,
        WarningException
 };
 
@@ -33,14 +34,17 @@ class ExceptionMessage: public std::exception {
 public:
        ExceptionMessage(ExceptionType type, docstring const & title,
                docstring const & details)
-               : exception((to_utf8(title) + "\n" + to_utf8(details)).c_str()),
-       type_(type), title_(title), details_(details) {}
+       : type_(type), title_(title), details_(details),
+         message_(to_utf8(title_ + docstring::value_type('\n') + details_)) {}
 
-       virtual ~ExceptionMessage() {}
+       virtual const char * what() const throw() { return message_.c_str(); }
+       virtual ~ExceptionMessage() throw() {}
 
        ExceptionType type_;
        docstring title_;
        docstring details_;
+       // Needed because we may not return a temporary in what().
+       std::string message_;
 };
 
 } // namespace support