/***************************************************************************
 * contractException.cpp
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2007- the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#include "contractException.h"

using namespace ktabedit;

ContractException::ContractException(const std::string& msg) throw()
: mMsg(msg),
  mBacktrace()
{
}

ContractException::ContractException(const std::string& msg, const std::string& backtrace) throw()
: mMsg(msg),
  mBacktrace(backtrace)
{
}

ContractException::~ContractException() throw()
{
}

const char* ContractException::what() const throw ()
{
	if (mBacktrace != std::string())
		return (mBacktrace + std::string("\n") + mMsg + std::string("\n")).c_str();
	else
		return (mMsg + std::string("\n")).c_str();
}
