lib

exception.cpp

00001 /***************************************************************************
00002  * exception.cpp
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #include "exception.h"
00021 
00022 //#include <qstring.h>
00023 //#include <ksharedptr.h>
00024 #include <kdebug.h>
00025 
00026 using namespace Kross::Api;
00027 
00028 Exception::Exception(const QString& error, long lineno, Object::Ptr parent)
00029     : Object("Exception", parent)
00030     , m_error(error)
00031     , m_lineno(lineno)
00032 {
00033     kdWarning() << QString("Kross::Api::Exception error='%1' lineno='%3'").arg(m_error).arg(m_lineno) << endl;
00034 }
00035 
00036 Exception::~Exception()
00037 {
00038 }
00039 
00040 const QString Exception::getClassName() const
00041 {
00042     return "Kross::Api::Exception";
00043 }
00044 
00045 const QString Exception::toString()
00046 {
00047     return (m_lineno != -1)
00048         ? QString("Exception at line %1: %2").arg(m_lineno).arg(m_error)
00049         : QString("Exception: %1").arg(m_error);
00050 }
00051 
00052 const QString& Exception::getError() const
00053 {
00054     return m_error;
00055 }
00056 
00057 const QString& Exception::getTrace() const
00058 {
00059     return m_trace;
00060 }
00061 
00062 void Exception::setTrace(const QString& tracemessage)
00063 {
00064     m_trace = tracemessage;
00065 }
00066 
00067 long Exception::getLineNo() const
00068 {
00069     return m_lineno;
00070 }
00071 
KDE Home | KDE Accessibility Home | Description of Access Keys