add try catch
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
#include <any>
|
#include <any>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <hack/security/uuid.hpp>
|
#include <hack/security/uuid.hpp>
|
||||||
|
#include <hack/exception/exception.hpp>
|
||||||
|
#include <hack/logger/logger.hpp>
|
||||||
|
|
||||||
namespace VE
|
namespace VE
|
||||||
{
|
{
|
||||||
@@ -21,7 +23,17 @@ namespace VE
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
T get_result()
|
T get_result()
|
||||||
{
|
{
|
||||||
auto r = std::any_cast<T>(m_result);
|
T r;
|
||||||
|
try { r = std::any_cast<T>(m_result); }
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::exception ex;
|
||||||
|
ex.service(e.what());
|
||||||
|
ex.description("dont convert type any_cast");
|
||||||
|
ex.log();
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user