lib

exception.cpp
1/***************************************************************************
2 * exception.cpp
3 * This file is part of the KDE project
4 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#include "object.h"
21#include "exception.h"
22
23//#include <tqstring.h>
24//#include <ksharedptr.h>
25
26using namespace Kross::Api;
27
28Exception::Exception(const TQString& error, long lineno)
29 : Object()
30 , m_error(error)
31 , m_lineno(lineno)
32{
33 krosswarning( TQString("Kross::Api::Exception error='%1' lineno='%3'").arg(m_error).arg(m_lineno) );
34}
35
39
40const TQString Exception::getClassName() const
41{
42 return "Kross::Api::Exception";
43}
44
45const TQString Exception::toString()
46{
47 return (m_lineno != -1)
48 ? TQString("Exception at line %1: %2").arg(m_lineno).arg(m_error)
49 : TQString("Exception: %1").arg(m_error);
50}
51
52const TQString Exception::getError() const
53{
54 return m_error;
55}
56
57const TQString Exception::getTrace() const
58{
59 return m_trace;
60}
61
62void Exception::setTrace(const TQString& tracemessage)
63{
64 m_trace = tracemessage;
65}
66
68{
69 return m_lineno;
70}
71
Exception(const TQString &error, long lineno=-1)
Constructor.
Definition exception.cpp:28
virtual const TQString toString()
Definition exception.cpp:45
virtual const TQString getClassName() const
Definition exception.cpp:40
const TQString getTrace() const
Definition exception.cpp:57
long getLineNo() const
Definition exception.cpp:67
virtual ~Exception()
Destructor.
Definition exception.cpp:36
const TQString getError() const
Definition exception.cpp:52
void setTrace(const TQString &tracemessage)
Set a more detailed tracemessage.
Definition exception.cpp:62
Object()
Constructor.
Definition object.cpp:29
The common Kross API used as common codebase.
Definition callable.h:31
void krosswarning(const TQString &s)
Warning function.