2011-12-12 06:15:34 +00:00
|
|
|
#pragma once
|
2010-03-01 16:59:51 +00:00
|
|
|
|
2012-11-16 22:08:15 +00:00
|
|
|
#include <cerrno>
|
2012-02-27 06:28:20 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2010-03-01 16:59:51 +00:00
|
|
|
#include <Poco/Exception.h>
|
2012-02-27 06:28:20 +00:00
|
|
|
#include <Poco/SharedPtr.h>
|
|
|
|
|
2011-12-12 06:15:34 +00:00
|
|
|
#include <DB/Core/StackTrace.h>
|
2010-03-01 16:59:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2011-12-12 06:15:34 +00:00
|
|
|
class Exception : public Poco::Exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Exception(int code = 0);
|
|
|
|
Exception(const std::string & msg, int code = 0);
|
|
|
|
Exception(const std::string & msg, const std::string & arg, int code = 0);
|
|
|
|
Exception(const std::string & msg, const Exception & exc, int code = 0);
|
|
|
|
Exception(const Exception & exc);
|
2012-05-08 05:42:05 +00:00
|
|
|
explicit Exception(const Poco::Exception & exc);
|
2011-12-12 06:15:34 +00:00
|
|
|
~Exception() throw();
|
|
|
|
Exception & operator = (const Exception & exc);
|
|
|
|
const char * name() const throw();
|
|
|
|
const char * className() const throw();
|
|
|
|
Exception * clone() const;
|
|
|
|
void rethrow() const;
|
|
|
|
|
|
|
|
const StackTrace & getStackTrace() const { return trace; }
|
2010-03-01 16:59:51 +00:00
|
|
|
|
2011-12-12 06:15:34 +00:00
|
|
|
private:
|
|
|
|
StackTrace trace;
|
|
|
|
};
|
|
|
|
|
2012-02-27 06:28:20 +00:00
|
|
|
using Poco::SharedPtr;
|
|
|
|
|
2012-03-30 19:56:18 +00:00
|
|
|
typedef SharedPtr<Poco::Exception> ExceptionPtr;
|
2012-02-27 06:28:20 +00:00
|
|
|
typedef std::vector<ExceptionPtr> Exceptions;
|
|
|
|
|
2012-05-14 20:37:10 +00:00
|
|
|
|
2012-11-16 19:38:11 +00:00
|
|
|
void throwFromErrno(const std::string & s, int code = 0, int the_errno = errno);
|
2012-05-14 20:37:10 +00:00
|
|
|
|
2011-12-12 06:15:34 +00:00
|
|
|
}
|