* Generates a user-friendly error report. */
| 194 | * Generates a user-friendly error report. |
| 195 | */ |
| 196 | string exception::to_string( log_level ll )const |
| 197 | { |
| 198 | const auto deadline = fc::time_point::now() + format_time_limit; |
| 199 | std::stringstream ss; |
| 200 | try { |
| 201 | ss << my->_what; |
| 202 | try { |
| 203 | ss << " (" << variant( my->_code ).as_string() << ")\n"; |
| 204 | } catch( std::bad_alloc& ) { |
| 205 | throw; |
| 206 | } catch( ... ) { |
| 207 | ss << "<- exception in to_string.\n"; |
| 208 | } |
| 209 | for( auto itr = my->_elog.begin(); itr != my->_elog.end(); ++itr ) { |
| 210 | try { |
| 211 | FC_CHECK_DEADLINE(deadline); |
| 212 | ss << fc::format_string( itr->get_format(), itr->get_data(), true) << "\n"; |
| 213 | // ss << " " << itr->get_context().to_string() <<"\n"; |
| 214 | } catch( std::bad_alloc& ) { |
| 215 | throw; |
| 216 | } catch( const fc::timeout_exception& e) { |
| 217 | ss << "<- timeout exception in to_string: " << e.what(); |
| 218 | break; |
| 219 | } catch( ... ) { |
| 220 | ss << "<- exception in to_string.\n"; |
| 221 | } |
| 222 | } |
| 223 | return ss.str(); |
| 224 | } catch( std::bad_alloc& ) { |
| 225 | throw; |
| 226 | } catch( ... ) { |
| 227 | ss << "<- exception in to_string.\n"; |
| 228 | } |
| 229 | return ss.str(); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Generates a user-friendly error report. |
no test coverage detected