]> git.lyx.org Git - lyx.git/blobdiff - src/support/ExceptionMessage.h
remove lyxrc dependence from support/*
[lyx.git] / src / support / ExceptionMessage.h
index dc597c6547cf6d97ac69fc8e8d9bfbeff27b123a..9b752be029e5351d73ebf675e01b913fd2c6502b 100644 (file)
@@ -33,14 +33,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_ + '\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