提交 26096423 编写于 作者: A Alexey Milovidov

Maybe better exception handling [#CONV-4347].

上级 3a630c0d
......@@ -34,7 +34,7 @@ private:
using Poco::SharedPtr;
typedef SharedPtr<Exception> ExceptionPtr;
typedef SharedPtr<Poco::Exception> ExceptionPtr;
typedef std::vector<ExceptionPtr> Exceptions;
}
......@@ -59,7 +59,7 @@ protected:
bool started;
Block block;
SharedPtr<Exception> exception;
ExceptionPtr exception;
/// Вычисления, которые могут выполняться в отдельном потоке
void calculate()
......@@ -70,11 +70,11 @@ protected:
}
catch (const Exception & e)
{
exception = new Exception(e);
exception = e.clone();
}
catch (const Poco::Exception & e)
{
exception = new Exception(e.message(), ErrorCodes::POCO_EXCEPTION);
exception = e.clone();
}
catch (const std::exception & e)
{
......
......@@ -86,11 +86,11 @@ private:
}
catch (const Exception & e)
{
exception = new Exception(e);
exception = e.clone();
}
catch (const Poco::Exception & e)
{
exception = new Exception(e.message(), ErrorCodes::POCO_EXCEPTION);
exception = e.clone();
}
catch (const std::exception & e)
{
......
......@@ -138,7 +138,7 @@ private:
unsigned count; /// Сколько блоков было вычислено
bool ready; /// Блок уже вычислен
Block block;
SharedPtr<Exception> exception;
ExceptionPtr exception;
void reset()
{
......@@ -183,12 +183,12 @@ private:
}
catch (const Exception & e)
{
data.exception = new Exception(e);
data.exception = e.clone();
}
catch (const Poco::Exception & e)
{
//std::cerr << e.message() << std::endl;
data.exception = new Exception(e.message(), ErrorCodes::POCO_EXCEPTION);
data.exception = e.clone();
}
catch (const std::exception & e)
{
......
......@@ -5,6 +5,7 @@
#include <vector>
#include <Poco/SharedPtr.h>
#include <Poco/Net/NetException.h>
#include <statdaemons/threadpool.hpp>
......@@ -74,7 +75,7 @@ public:
out.next();
}
SharedPtr<Exception> exception;
ExceptionPtr exception;
/// То, что выполняется в отдельном потоке
void thread()
......@@ -85,11 +86,11 @@ public:
}
catch (const Exception & e)
{
exception = new Exception(e);
exception = e.clone();
}
catch (const Poco::Exception & e)
{
exception = new Exception(e.message(), ErrorCodes::POCO_EXCEPTION);
exception = e.clone();
}
catch (const std::exception & e)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册