+ in setPyObject() only use classes derived from Base::Exception

This commit is contained in:
wmayer
2013-07-05 15:29:04 +02:00
parent 9729270c65
commit 609072f140
14 changed files with 196 additions and 64 deletions

View File

@@ -236,6 +236,74 @@ ProgramInformation::ProgramInformation(const ProgramInformation &inst)
// ---------------------------------------------------------
TypeError::TypeError(const char * sMessage)
: Exception(sMessage)
{
}
TypeError::TypeError(const std::string& sMessage)
: Exception(sMessage)
{
}
TypeError::TypeError(const TypeError &inst)
: Exception(inst)
{
}
// ---------------------------------------------------------
ValueError::ValueError(const char * sMessage)
: Exception(sMessage)
{
}
ValueError::ValueError(const std::string& sMessage)
: Exception(sMessage)
{
}
ValueError::ValueError(const ValueError &inst)
: Exception(inst)
{
}
// ---------------------------------------------------------
AttributeError::AttributeError(const char * sMessage)
: Exception(sMessage)
{
}
AttributeError::AttributeError(const std::string& sMessage)
: Exception(sMessage)
{
}
AttributeError::AttributeError(const AttributeError &inst)
: Exception(inst)
{
}
// ---------------------------------------------------------
RuntimeError::RuntimeError(const char * sMessage)
: Exception(sMessage)
{
}
RuntimeError::RuntimeError(const std::string& sMessage)
: Exception(sMessage)
{
}
RuntimeError::RuntimeError(const RuntimeError &inst)
: Exception(inst)
{
}
// ---------------------------------------------------------
#if defined(__GNUC__) && defined (FC_OS_LINUX)
#include <stdexcept>
#include <iostream>

View File

@@ -206,6 +206,70 @@ public:
virtual ~ProgramInformation() throw() {}
};
/**
* The TypeError can be used to indicate the usage of a wrong type.
* @author Werner Mayer
*/
class BaseExport TypeError : public Exception
{
public:
/// Construction
TypeError(const char * sMessage);
TypeError(const std::string& sMessage);
/// Construction
TypeError(const TypeError &inst);
/// Destruction
virtual ~TypeError() throw() {}
};
/**
* The ValueError can be used to indicate the usage of a wrong value.
* @author Werner Mayer
*/
class BaseExport ValueError : public Exception
{
public:
/// Construction
ValueError(const char * sMessage);
ValueError(const std::string& sMessage);
/// Construction
ValueError(const ValueError &inst);
/// Destruction
virtual ~ValueError() throw() {}
};
/**
* The AttributeError can be used to indicate the usage of a wrong value.
* @author Werner Mayer
*/
class BaseExport AttributeError : public Exception
{
public:
/// Construction
AttributeError(const char * sMessage);
AttributeError(const std::string& sMessage);
/// Construction
AttributeError(const AttributeError &inst);
/// Destruction
virtual ~AttributeError() throw() {}
};
/**
* The RuntimeError can be used to indicate an unknown exception at runtime.
* @author Werner Mayer
*/
class BaseExport RuntimeError : public Exception
{
public:
/// Construction
RuntimeError(const char * sMessage);
RuntimeError(const std::string& sMessage);
/// Construction
RuntimeError(const RuntimeError &inst);
/// Destruction
virtual ~RuntimeError() throw() {}
};
inline void Exception::setMessage(const char * sMessage)
{