-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfactory.cpp
41 lines (34 loc) · 1.04 KB
/
factory.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//-------------------------------------------
// utils/factory.cpp: Predicate-based factory
//-------------------------------------------
//
// Copyright kennytm (auraHT Ltd.) 2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file doc/LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <utils/factory.hpp>
namespace utils {
factory_error::factory_error(std::vector<std::exception_ptr>&& exceptions)
: exceptions(std::move(exceptions))
{
std::string ret_str = "Factory creation failed, and the following exceptions were thrown in the process:\n";
for (auto& exc : this->exceptions)
{
try
{
std::rethrow_exception(exc);
}
catch (const std::exception& e)
{
ret_str += e.what();
ret_str.push_back('\n');
}
}
_what = std::move(ret_str);
}
factory_error::~factory_error() noexcept {}
const char* factory_error::what() const noexcept
{
return _what.c_str();
}
}