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>
|
|
|
|
|
|
2014-04-02 10:29:54 +00:00
|
|
|
|
#include <statdaemons/Exception.h>
|
2012-02-27 06:28:20 +00:00
|
|
|
|
#include <Poco/SharedPtr.h>
|
|
|
|
|
|
2010-03-01 16:59:51 +00:00
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
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
|
|
|
|
|
2013-11-02 23:42:10 +00:00
|
|
|
|
|
|
|
|
|
/** Для использования в блоке catch (...).
|
|
|
|
|
* Преобразует Exception, Poco::Exception, std::exception или неизвестный exception в ExceptionPtr.
|
|
|
|
|
*/
|
|
|
|
|
ExceptionPtr cloneCurrentException();
|
|
|
|
|
|
2013-11-18 19:18:03 +00:00
|
|
|
|
/** Попробовать записать исключение в лог (и забыть про него).
|
|
|
|
|
* Можно использовать в деструкторах в блоке catch (...).
|
|
|
|
|
*/
|
|
|
|
|
void tryLogCurrentException(const char * log_name);
|
|
|
|
|
|
2013-11-02 23:42:10 +00:00
|
|
|
|
|
|
|
|
|
void rethrowFirstException(Exceptions & exceptions);
|
|
|
|
|
|
|
|
|
|
|
2011-12-12 06:15:34 +00:00
|
|
|
|
}
|