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 "krossdebug.h"
24
25using namespace Kross::Api;
26
27Exception::Exception(const TQString& error, long lineno)
28 : Object()
29 , m_error(error)
30 , m_lineno(lineno)
31{
32 krosswarning( TQString("Kross::Api::Exception error='%1' lineno='%3'").arg(m_error).arg(m_lineno) );
33}
34
38
39const TQString Exception::getClassName() const
40{
41 return "Kross::Api::Exception";
42}
43
44const TQString Exception::toString()
45{
46 return (m_lineno != -1)
47 ? TQString("Exception at line %1: %2").arg(m_lineno).arg(m_error)
48 : TQString("Exception: %1").arg(m_error);
49}
50
51const TQString Exception::getError() const
52{
53 return m_error;
54}
55
56const TQString Exception::getTrace() const
57{
58 return m_trace;
59}
60
61void Exception::setTrace(const TQString& tracemessage)
62{
63 m_trace = tracemessage;
64}
65
67{
68 return m_lineno;
69}
70
Exception(const TQString &error, long lineno=-1)
Constructor.
Definition exception.cpp:27
virtual const TQString toString()
Definition exception.cpp:44
virtual const TQString getClassName() const
Definition exception.cpp:39
const TQString getTrace() const
Definition exception.cpp:56
long getLineNo() const
Definition exception.cpp:66
virtual ~Exception()
Destructor.
Definition exception.cpp:35
const TQString getError() const
Definition exception.cpp:51
void setTrace(const TQString &tracemessage)
Set a more detailed tracemessage.
Definition exception.cpp:61
Object()
Constructor.
Definition object.cpp:29
The common Kross API used as common codebase.
Definition callable.h:33
KOFFICE_EXPORT void krosswarning(const TQString &s)
Warning function.