3 * \file ExceptionMessage.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Abdelrazak Younes
9 * Full author contact details are available in file CREDITS.
15 #include "support/docstring.h"
22 /// LyX support three types of custom exceptions. In order of
23 /// increasing seriousness, these are:
26 /// Intended for unexpected situations that we do not expect
27 /// to compromise further operation. It has the effect of
28 /// aborting whatever operation in in process.
31 /// Intended for situations that indicate some problem with a
32 /// Buffer or its related data structures. The Buffer will be
33 /// closed, in emergency style.
36 /// Intended for situations that indicate a global problem
37 /// with the program. It will lead to an emergency shutdown.
46 class ExceptionMessage: public std::exception {
48 ExceptionMessage(ExceptionType type, docstring const & title,
49 docstring const & details)
50 : type_(type), title_(title), details_(details),
51 message_(to_utf8(title_ + docstring::value_type('\n') + details_)) {}
53 virtual const char * what() const throw() { return message_.c_str(); }
54 virtual ~ExceptionMessage() throw() {}
59 // Needed because we may not return a temporary in what().
63 } // namespace support
66 #endif // LYX_MESSAGE_H