Code::Blocks  SVN r11506
cbexception.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 8300 $
6  * $Id: cbexception.cpp 8300 2012-08-31 11:35:40Z jenslody $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/cbexception.cpp $
8  */
9 
10 #include "sdk_precomp.h"
11 
12 #ifndef CB_PRECOMP
13  #include "cbexception.h"
14  #include "globals.h"
15  #include "configmanager.h"
16  #include <wx/log.h> // for wxSafeShowMessage()
17 #endif
18 
19 #include <wx/intl.h>
20 
21 cbException::cbException(const wxString& msg, const wxString& file, int line)
22  : Message(msg),
23  File(file),
24  Line(line)
25 {}
26 
28 {}
29 
30 
32 {
33  wxString gccvers;
34 #ifdef __GNUC__
35  gccvers.Printf(_T("gcc %d.%d.%d"), __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
36 #endif
37 
38  wxString title = _("Exception");
39  wxString err;
40  err.Printf(_("An exception has been raised!\n\n"
41  "The application encountered an error at %s, on line %d.\n"
42  "The error message is:\n\n%s\n\n"
43  "Code::Blocks Version revision %u (%s, "
44  "build: %s %s)"),
45  File.c_str(), Line, Message.c_str(),
47  wxT(__DATE__), wxT(__TIME__));
48  if (safe)
49  wxSafeShowMessage(title, err);
50  else
51  cbMessageBox(err, title, wxICON_ERROR);
52 }
cbException(const wxString &msg, const wxString &file, int line)
Definition: cbexception.cpp:21
void wxSafeShowMessage(const wxString &title, const wxString &text)
#define wxICON_ERROR
static unsigned int GetRevisionNumber()
wxCStrData c_str() const
#define _T(string)
wxString File
The file where the exception was raised.
Definition: cbexception.h:37
#define wxT(string)
int Line
The line in the file where the exception was raised.
Definition: cbexception.h:38
virtual ~cbException()
Definition: cbexception.cpp:27
const wxString & _(const wxString &string)
void ShowErrorMessage(bool safe=true)
Display exception error message.
Definition: cbexception.cpp:31
wxString Message
The exception&#39;s error message.
Definition: cbexception.h:36
int Printf(const wxString &pszFormat,...)
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
Definition: globals.cpp:1395