~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/sdk/cbexception.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: 4909 $
 
6
 * $Id: cbexception.cpp 4909 2008-02-27 13:15:26Z mortenmacfly $
 
7
 * $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/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
 
 
27
cbException::~cbException()
 
28
{}
 
29
 
 
30
 
 
31
void cbException::ShowErrorMessage(bool safe)
 
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 %d (%s, "
 
44
                 "build: %s %s)"),
 
45
               File.c_str(), Line, Message.c_str(),
 
46
               ConfigManager::GetRevisionNumber(), gccvers.c_str(),
 
47
               wxT(__DATE__), wxT(__TIME__));
 
48
    if (safe)
 
49
        wxSafeShowMessage(title, err);
 
50
    else
 
51
        cbMessageBox(err, title, wxICON_ERROR);
 
52
}