]> git.lyx.org Git - lyx.git/blob - src/boost.cpp
9d2d2b8aa247d4d29753b6c4434f368b6a96b5b8
[lyx.git] / src / boost.cpp
1 /**
2  * \file boost.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "LyX.h"
14
15 #include "support/debug.h"
16
17 #include <boost/assert.hpp>
18
19 #include <exception>
20 #include <iomanip>
21 #include <iostream>
22
23 using namespace std;
24 using lyx::lyxerr;
25 using lyx::LyX;
26
27 namespace boost {
28
29 #ifndef BOOST_NO_EXCEPTIONS
30 void throw_exception(exception const & e)
31 {
32         lyxerr << "Exception caught:\n" << e.what() << endl;
33         BOOST_ASSERT(false);
34 }
35 #endif
36
37
38 void assertion_failed(char const * expr, char const * function,
39                       char const * file, long line)
40 {
41         lyxerr << "Assertion triggered in " << function
42                << " by failing check \"" << expr << "\""
43                << " in file " << file << ":" << line << endl;
44
45         // FIXME: by default we exit here but we could also inform the user
46         // about the assertion and do the emergency cleanup without exiting.
47         // FIXME: do we have a list of exit codes defined somewhere?
48         LyX::cref().exit(1);
49 }
50
51 } // namespace boost