jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
exception.cpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011,2012 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #include "exception.hpp"
18 #include <cstring>
19 #include <string>
20 #include "jubatus/util/lang/demangle.h"
21 
22 namespace jubatus {
23 namespace core {
24 namespace common {
25 namespace exception {
26 
28  return info_list_;
29 }
30 
31 std::string jubatus_exception::diagnostic_information(bool display_what) const {
32  std::ostringstream tmp;
33 
34  tmp << "Dynamic exception type: ";
35  tmp << jubatus::util::lang::demangle(typeid(*this).name());
36 
37  if (display_what && strcmp(what(), "")) {
38  tmp << "::what: " << what();
39  }
40 
41  tmp << '\n';
42 
43  size_t frame = 0;
44  for (error_info_list_t::const_iterator it = info_list_.begin(), end =
45  info_list_.end(); it != end; ++it) {
46  if ((*it)->splitter()) {
47  frame++;
48  continue;
49  }
50  tmp << " #" << frame << " [" << (*it)->tag_typeid_name() << "] = "
51  << (*it)->as_string() << '\n';
52  }
53  return tmp.str();
54 }
55 
56 } // namespace exception
57 } // namespace common
58 } // namespace core
59 } // namespace jubatus
std::vector< jubatus::util::lang::shared_ptr< error_info_base > > error_info_list_t
Definition: exception.hpp:88
std::string diagnostic_information(bool display_what=false) const
Definition: exception.cpp:31