50 lines
920 B
C++

//----------------------------------------------------------------------------
//
// Copyright (C) 2008 Intel Corporation
//
// File: LogicException.h
//
// Contents: Logic Exception definition
//
//----------------------------------------------------------------------------
#ifndef __SAMPLES_EXCEPTION_H
#define __SAMPLES_EXCEPTION_H
#include <string>
#include <stdexcept>
using namespace std;
namespace ExceptionNamespace
{
class LogicException : public exception
{
private:
string _what;
unsigned int error;
public:
LogicException(const char* what, unsigned int err) :
_what(what), error(err){}
LogicException(const char* what) :
_what(what), error(0){}
virtual string getDetail()
{
return _what;
}
virtual const char *what() const throw()
{
return _what.c_str();
};
virtual unsigned int getErr() const throw()
{
return error;
}
};
}
#endif