add try catch
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <any>
|
||||
#include <string>
|
||||
#include <hack/security/uuid.hpp>
|
||||
#include <hack/exception/exception.hpp>
|
||||
#include <hack/logger/logger.hpp>
|
||||
|
||||
namespace VE
|
||||
{
|
||||
@@ -21,7 +23,17 @@ namespace VE
|
||||
template<typename T>
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user