Merge pull request #740

f7301c3 Revert "Print stack trace upon exceptions" (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2016-03-21 12:55:37 +02:00
commit 0b4e75026a
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
43 changed files with 63 additions and 259 deletions

View File

@ -243,14 +243,6 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}") add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
find_package(Libunwind)
if(LIBUNWIND_FOUND)
message(STATUS "Using libunwind to provide stack traces")
add_definitions("-DHAVE_LIBUNWIND")
else()
message(STATUS "Stack traces disabled")
endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail # Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
@ -282,10 +274,6 @@ if (BERKELEY_DB)
include_directories(${BDB_INCLUDE}) include_directories(${BDB_INCLUDE})
endif() endif()
# Final setup for libunwind
include_directories(${LIBUNWIND_INCLUDE})
link_directories(${LIBUNWIND_LIBRARY_DIRS})
if(MSVC) if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__") add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline") # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")

View File

@ -1,25 +0,0 @@
# - Try to find libunwind
# Once done this will define
#
# LIBUNWIND_FOUND - system has libunwind
# LIBUNWIND_INCLUDE_DIR - the libunwind include directory
# LIBUNWIND_LIBRARIES - Link these to use libunwind
# LIBUNWIND_DEFINITIONS - Compiler switches required for using libunwind
# Copyright (c) 2006, Alexander Dymo, <adymo@kdevelop.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
find_path(LIBUNWIND_INCLUDE_DIR libunwind.h
/usr/include
/usr/local/include
)
find_library(LIBUNWIND_LIBRARIES NAMES unwind )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libunwind "Could not find libunwind" LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES)
# show the LIBUNWIND_INCLUDE_DIR and LIBUNWIND_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES )

View File

@ -1426,7 +1426,7 @@ POP_WARNINGS
#define CATCH_ENTRY_L4(lacation, return_val) CATCH_ENTRY(lacation, return_val) #define CATCH_ENTRY_L4(lacation, return_val) CATCH_ENTRY(lacation, return_val)
#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw tools::runtime_error(ss.str());} #define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw std::runtime_error(ss.str());}
#define CHECK_AND_ASSERT_THROW_MES(expr, message) {if(!(expr)) ASSERT_MES_AND_THROW(message);} #define CHECK_AND_ASSERT_THROW_MES(expr, message) {if(!(expr)) ASSERT_MES_AND_THROW(message);}

View File

@ -777,7 +777,7 @@ POP_WARNINGS
{ {
m_thread_name_prefix = prefix_name; m_thread_name_prefix = prefix_name;
auto it = server_type_map.find(m_thread_name_prefix); auto it = server_type_map.find(m_thread_name_prefix);
if (it==server_type_map.end()) throw tools::runtime_error("Unknown prefix/server type:" + std::string(prefix_name)); if (it==server_type_map.end()) throw std::runtime_error("Unknown prefix/server type:" + std::string(prefix_name));
auto connection_type = it->second; // the value of type auto connection_type = it->second; // the value of type
_info_c("net/RPClog", "Set server type to: " << connection_type << " from name: " << m_thread_name_prefix); _info_c("net/RPClog", "Set server type to: " << connection_type << " from name: " << m_thread_name_prefix);
_info_c("net/RPClog", "prefix_name = " << prefix_name); _info_c("net/RPClog", "prefix_name = " << prefix_name);

View File

@ -84,9 +84,9 @@ namespace epee
inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz) inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz)
{ {
if(!ptr) if(!ptr)
throw tools::runtime_error("throwable_buffer_reader: ptr==nullptr"); throw std::runtime_error("throwable_buffer_reader: ptr==nullptr");
if(!sz) if(!sz)
throw tools::runtime_error("throwable_buffer_reader: sz==0"); throw std::runtime_error("throwable_buffer_reader: sz==0");
m_ptr = (uint8_t*)ptr; m_ptr = (uint8_t*)ptr;
m_count = sz; m_count = sz;
m_recursion_count = 0; m_recursion_count = 0;

View File

@ -33,7 +33,6 @@
#include <list> #include <list>
#include <string> #include <string>
#include <exception> #include <exception>
#include "common/exception.h"
#include "crypto/hash.h" #include "crypto/hash.h"
#include "cryptonote_core/cryptonote_basic.h" #include "cryptonote_core/cryptonote_basic.h"
#include "cryptonote_core/difficulty.h" #include "cryptonote_core/difficulty.h"
@ -152,7 +151,7 @@ struct output_data_t
/*********************************** /***********************************
* Exception Definitions * Exception Definitions
***********************************/ ***********************************/
class DB_EXCEPTION : public tools::exception class DB_EXCEPTION : public std::exception
{ {
private: private:
std::string m; std::string m;

View File

@ -198,7 +198,7 @@ int main(int argc, char* argv[])
else else
{ {
LOG_ERROR("Attempted to use non-existent database type: " << db_type); LOG_ERROR("Attempted to use non-existent database type: " << db_type);
throw tools::runtime_error("Attempting to use non-existent database type"); throw std::runtime_error("Attempting to use non-existent database type");
} }
LOG_PRINT_L0("database: " << db_type); LOG_PRINT_L0("database: " << db_type);

View File

@ -359,14 +359,14 @@ int import_from_file(FakeCore& simple_core, const std::string& import_file_path,
str1.assign(buffer1, sizeof(chunk_size)); str1.assign(buffer1, sizeof(chunk_size));
if (! ::serialization::parse_binary(str1, chunk_size)) if (! ::serialization::parse_binary(str1, chunk_size))
{ {
throw tools::runtime_error("Error in deserialization of chunk size"); throw std::runtime_error("Error in deserialization of chunk size");
} }
LOG_PRINT_L3("chunk_size: " << chunk_size); LOG_PRINT_L3("chunk_size: " << chunk_size);
if (chunk_size > BUFFER_SIZE) if (chunk_size > BUFFER_SIZE)
{ {
LOG_PRINT_L0("WARNING: chunk_size " << chunk_size << " > BUFFER_SIZE " << BUFFER_SIZE); LOG_PRINT_L0("WARNING: chunk_size " << chunk_size << " > BUFFER_SIZE " << BUFFER_SIZE);
throw tools::runtime_error("Aborting: chunk size exceeds buffer size"); throw std::runtime_error("Aborting: chunk size exceeds buffer size");
} }
if (chunk_size > 100000) if (chunk_size > 100000)
{ {
@ -406,7 +406,7 @@ int import_from_file(FakeCore& simple_core, const std::string& import_file_path,
str1.assign(buffer_block, chunk_size); str1.assign(buffer_block, chunk_size);
bootstrap::block_package bp; bootstrap::block_package bp;
if (! ::serialization::parse_binary(str1, bp)) if (! ::serialization::parse_binary(str1, bp))
throw tools::runtime_error("Error in deserialization of chunk"); throw std::runtime_error("Error in deserialization of chunk");
int display_interval = 1000; int display_interval = 1000;
int progress_interval = 10; int progress_interval = 10;

View File

@ -117,7 +117,7 @@ bool BootstrapFile::initialize_file()
std::string blob; std::string blob;
if (! ::serialization::dump_binary(file_magic, blob)) if (! ::serialization::dump_binary(file_magic, blob))
{ {
throw tools::runtime_error("Error in serialization of file magic"); throw std::runtime_error("Error in serialization of file magic");
} }
*m_raw_data_file << blob; *m_raw_data_file << blob;
@ -143,7 +143,7 @@ bool BootstrapFile::initialize_file()
if (! ::serialization::dump_binary(bd_size, blob)) if (! ::serialization::dump_binary(bd_size, blob))
{ {
throw tools::runtime_error("Error in serialization of bootstrap::file_info size"); throw std::runtime_error("Error in serialization of bootstrap::file_info size");
} }
*output_stream_header << blob; *output_stream_header << blob;
*output_stream_header << bd; *output_stream_header << bd;
@ -154,7 +154,7 @@ bool BootstrapFile::initialize_file()
if (! ::serialization::dump_binary(bd_size, blob)) if (! ::serialization::dump_binary(bd_size, blob))
{ {
throw tools::runtime_error("Error in serialization of bootstrap::blocks_info size"); throw std::runtime_error("Error in serialization of bootstrap::blocks_info size");
} }
*output_stream_header << blob; *output_stream_header << blob;
*output_stream_header << bd; *output_stream_header << bd;
@ -181,7 +181,7 @@ void BootstrapFile::flush_chunk()
std::string blob; std::string blob;
if (! ::serialization::dump_binary(chunk_size, blob)) if (! ::serialization::dump_binary(chunk_size, blob))
{ {
throw tools::runtime_error("Error in serialization of chunk size"); throw std::runtime_error("Error in serialization of chunk size");
} }
*m_raw_data_file << blob; *m_raw_data_file << blob;
@ -197,7 +197,7 @@ void BootstrapFile::flush_chunk()
if (static_cast<unsigned long>(num_chars_written) != chunk_size) if (static_cast<unsigned long>(num_chars_written) != chunk_size)
{ {
LOG_PRINT_RED_L0("Error writing chunk: height: " << m_cur_height << " chunk_size: " << chunk_size << " num chars written: " << num_chars_written); LOG_PRINT_RED_L0("Error writing chunk: height: " << m_cur_height << " chunk_size: " << chunk_size << " num chars written: " << num_chars_written);
throw tools::runtime_error("Error writing chunk"); throw std::runtime_error("Error writing chunk");
} }
m_buffer.clear(); m_buffer.clear();
@ -221,7 +221,7 @@ void BootstrapFile::write_block(block& block)
{ {
if (tx_id == null_hash) if (tx_id == null_hash)
{ {
throw tools::runtime_error("Aborting: tx == null_hash"); throw std::runtime_error("Aborting: tx == null_hash");
} }
#if SOURCE_DB == DB_MEMORY #if SOURCE_DB == DB_MEMORY
const transaction* tx = m_blockchain_storage->get_tx(tx_id); const transaction* tx = m_blockchain_storage->get_tx(tx_id);
@ -233,14 +233,14 @@ void BootstrapFile::write_block(block& block)
if(tx == NULL) if(tx == NULL)
{ {
if (! m_tx_pool) if (! m_tx_pool)
throw tools::runtime_error("Aborting: tx == NULL, so memory pool required to get tx, but memory pool isn't enabled"); throw std::runtime_error("Aborting: tx == NULL, so memory pool required to get tx, but memory pool isn't enabled");
else else
{ {
transaction tx; transaction tx;
if(m_tx_pool->get_transaction(tx_id, tx)) if(m_tx_pool->get_transaction(tx_id, tx))
txs.push_back(tx); txs.push_back(tx);
else else
throw tools::runtime_error("Aborting: tx not found in pool"); throw std::runtime_error("Aborting: tx not found in pool");
} }
} }
else else
@ -362,16 +362,16 @@ uint64_t BootstrapFile::seek_to_first_chunk(std::ifstream& import_file)
char buf1[2048]; char buf1[2048];
import_file.read(buf1, sizeof(file_magic)); import_file.read(buf1, sizeof(file_magic));
if (! import_file) if (! import_file)
throw tools::runtime_error("Error reading expected number of bytes"); throw std::runtime_error("Error reading expected number of bytes");
str1.assign(buf1, sizeof(file_magic)); str1.assign(buf1, sizeof(file_magic));
if (! ::serialization::parse_binary(str1, file_magic)) if (! ::serialization::parse_binary(str1, file_magic))
throw tools::runtime_error("Error in deserialization of file_magic"); throw std::runtime_error("Error in deserialization of file_magic");
if (file_magic != blockchain_raw_magic) if (file_magic != blockchain_raw_magic)
{ {
LOG_PRINT_RED_L0("bootstrap file not recognized"); LOG_PRINT_RED_L0("bootstrap file not recognized");
throw tools::runtime_error("Aborting"); throw std::runtime_error("Aborting");
} }
else else
LOG_PRINT_L0("bootstrap file recognized"); LOG_PRINT_L0("bootstrap file recognized");
@ -381,20 +381,20 @@ uint64_t BootstrapFile::seek_to_first_chunk(std::ifstream& import_file)
import_file.read(buf1, sizeof(buflen_file_info)); import_file.read(buf1, sizeof(buflen_file_info));
str1.assign(buf1, sizeof(buflen_file_info)); str1.assign(buf1, sizeof(buflen_file_info));
if (! import_file) if (! import_file)
throw tools::runtime_error("Error reading expected number of bytes"); throw std::runtime_error("Error reading expected number of bytes");
if (! ::serialization::parse_binary(str1, buflen_file_info)) if (! ::serialization::parse_binary(str1, buflen_file_info))
throw tools::runtime_error("Error in deserialization of buflen_file_info"); throw std::runtime_error("Error in deserialization of buflen_file_info");
LOG_PRINT_L1("bootstrap::file_info size: " << buflen_file_info); LOG_PRINT_L1("bootstrap::file_info size: " << buflen_file_info);
if (buflen_file_info > sizeof(buf1)) if (buflen_file_info > sizeof(buf1))
throw tools::runtime_error("Error: bootstrap::file_info size exceeds buffer size"); throw std::runtime_error("Error: bootstrap::file_info size exceeds buffer size");
import_file.read(buf1, buflen_file_info); import_file.read(buf1, buflen_file_info);
if (! import_file) if (! import_file)
throw tools::runtime_error("Error reading expected number of bytes"); throw std::runtime_error("Error reading expected number of bytes");
str1.assign(buf1, buflen_file_info); str1.assign(buf1, buflen_file_info);
bootstrap::file_info bfi; bootstrap::file_info bfi;
if (! ::serialization::parse_binary(str1, bfi)) if (! ::serialization::parse_binary(str1, bfi))
throw tools::runtime_error("Error in deserialization of bootstrap::file_info"); throw std::runtime_error("Error in deserialization of bootstrap::file_info");
LOG_PRINT_L0("bootstrap file v" << unsigned(bfi.major_version) << "." << unsigned(bfi.minor_version)); LOG_PRINT_L0("bootstrap file v" << unsigned(bfi.major_version) << "." << unsigned(bfi.minor_version));
LOG_PRINT_L0("bootstrap magic size: " << sizeof(file_magic)); LOG_PRINT_L0("bootstrap magic size: " << sizeof(file_magic));
LOG_PRINT_L0("bootstrap header size: " << bfi.header_size); LOG_PRINT_L0("bootstrap header size: " << bfi.header_size);
@ -412,7 +412,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
if (!boost::filesystem::exists(raw_file_path, ec)) if (!boost::filesystem::exists(raw_file_path, ec))
{ {
LOG_PRINT_L0("bootstrap file not found: " << raw_file_path); LOG_PRINT_L0("bootstrap file not found: " << raw_file_path);
throw tools::runtime_error("Aborting"); throw std::runtime_error("Aborting");
} }
std::ifstream import_file; std::ifstream import_file;
import_file.open(import_file_path, std::ios_base::binary | std::ifstream::in); import_file.open(import_file_path, std::ios_base::binary | std::ifstream::in);
@ -421,7 +421,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
if (import_file.fail()) if (import_file.fail())
{ {
LOG_PRINT_L0("import_file.open() fail"); LOG_PRINT_L0("import_file.open() fail");
throw tools::runtime_error("Aborting"); throw std::runtime_error("Aborting");
} }
uint64_t full_header_size; // 4 byte magic + length of header structures uint64_t full_header_size; // 4 byte magic + length of header structures
@ -456,7 +456,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
str1.assign(buf1, sizeof(chunk_size)); str1.assign(buf1, sizeof(chunk_size));
if (! ::serialization::parse_binary(str1, chunk_size)) if (! ::serialization::parse_binary(str1, chunk_size))
throw tools::runtime_error("Error in deserialization of chunk_size"); throw std::runtime_error("Error in deserialization of chunk_size");
LOG_PRINT_L3("chunk_size: " << chunk_size); LOG_PRINT_L3("chunk_size: " << chunk_size);
if (chunk_size > BUFFER_SIZE) if (chunk_size > BUFFER_SIZE)
@ -464,7 +464,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
std::cout << refresh_string; std::cout << refresh_string;
LOG_PRINT_L0("WARNING: chunk_size " << chunk_size << " > BUFFER_SIZE " << BUFFER_SIZE LOG_PRINT_L0("WARNING: chunk_size " << chunk_size << " > BUFFER_SIZE " << BUFFER_SIZE
<< " height: " << h-1); << " height: " << h-1);
throw tools::runtime_error("Aborting: chunk size exceeds buffer size"); throw std::runtime_error("Aborting: chunk size exceeds buffer size");
} }
if (chunk_size > 100000) if (chunk_size > 100000)
{ {
@ -475,7 +475,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
else if (chunk_size <= 0) { else if (chunk_size <= 0) {
std::cout << refresh_string; std::cout << refresh_string;
LOG_PRINT_L0("ERROR: chunk_size " << chunk_size << " <= 0" << " height: " << h-1); LOG_PRINT_L0("ERROR: chunk_size " << chunk_size << " <= 0" << " height: " << h-1);
throw tools::runtime_error("Aborting"); throw std::runtime_error("Aborting");
} }
// skip to next expected block size value // skip to next expected block size value
import_file.seekg(chunk_size, std::ios_base::cur); import_file.seekg(chunk_size, std::ios_base::cur);
@ -483,7 +483,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
std::cout << refresh_string; std::cout << refresh_string;
LOG_PRINT_L0("ERROR: unexpected end of file: bytes read before error: " LOG_PRINT_L0("ERROR: unexpected end of file: bytes read before error: "
<< import_file.gcount() << " of chunk_size " << chunk_size); << import_file.gcount() << " of chunk_size " << chunk_size);
throw tools::runtime_error("Aborting"); throw std::runtime_error("Aborting");
} }
bytes_read += chunk_size; bytes_read += chunk_size;

View File

@ -78,7 +78,7 @@ struct fake_core_db
else else
{ {
LOG_ERROR("Attempted to use non-existent database type: " << db_type); LOG_ERROR("Attempted to use non-existent database type: " << db_type);
throw tools::runtime_error("Attempting to use non-existent database type"); throw std::runtime_error("Attempting to use non-existent database type");
} }
boost::filesystem::path folder(path); boost::filesystem::path folder(path);
@ -176,7 +176,7 @@ struct fake_core_memory
{ {
// TODO: // TODO:
// would need to refactor handle_block_to_main_chain() to have a direct add_block() method like Blockchain class // would need to refactor handle_block_to_main_chain() to have a direct add_block() method like Blockchain class
throw tools::runtime_error("direct add_block() method not implemented for in-memory db"); throw std::runtime_error("direct add_block() method not implemented for in-memory db");
return 2; return 2;
} }

View File

@ -31,7 +31,6 @@ set(common_sources
command_line.cpp command_line.cpp
dns_utils.cpp dns_utils.cpp
util.cpp util.cpp
exception.cpp
i18n.cpp) i18n.cpp)
set(common_headers) set(common_headers)
@ -49,7 +48,6 @@ set(common_private_headers
unordered_containers_boost_serialization.h unordered_containers_boost_serialization.h
util.h util.h
varint.h varint.h
exception.h
i18n.h) i18n.h)
bitmonero_private_headers(common bitmonero_private_headers(common
@ -62,7 +60,6 @@ target_link_libraries(common
LINK_PRIVATE LINK_PRIVATE
crypto crypto
${UNBOUND_LIBRARY} ${UNBOUND_LIBRARY}
${LIBUNWIND_LIBRARIES}
${Boost_DATE_TIME_LIBRARY} ${Boost_DATE_TIME_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}

View File

@ -1,84 +0,0 @@
// Copyright (c) 2016, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/exception.h"
#include "misc_log_ex.h"
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <cxxabi.h>
namespace tools
{
void log_stack_trace(const char *msg)
{
#ifdef HAVE_LIBUNWIND
unw_context_t ctx;
unw_cursor_t cur;
unw_word_t ip, off;
unsigned level;
char sym[512], *dsym;
int status;
if (msg)
LOG_PRINT_L0(msg);
LOG_PRINT_L0("Unwinded call stack:");
if (unw_getcontext(&ctx) < 0) {
LOG_PRINT_L0("Failed to create unwind context");
return;
}
if (unw_init_local(&cur, &ctx) < 0) {
LOG_PRINT_L0("Failed to find the first unwind frame");
return;
}
for (level = 1; level < 999; ++level) { // 999 for safety
int ret = unw_step(&cur);
if (ret < 0) {
LOG_PRINT_L0("Failed to find the next frame");
return;
}
if (ret == 0)
break;
if (unw_get_reg(&cur, UNW_REG_IP, &ip) < 0) {
LOG_PRINT_L0(" " << std::setw(4) << level);
continue;
}
if (unw_get_proc_name(&cur, sym, sizeof(sym), &off) < 0) {
LOG_PRINT_L0(" " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip);
continue;
}
dsym = abi::__cxa_demangle(sym, NULL, NULL, &status);
LOG_PRINT_L0(" " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip << " " << (!status && dsym ? dsym : sym) << " + " << "0x" << off);
free(dsym);
}
#else
#warning libunwind disabled, no stack traces
#endif
}
} // namespace tools

View File

@ -1,53 +0,0 @@
// Copyright (c) 2016, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef MONERO_EXCEPTION_H
#define MONERO_EXCEPTION_H
#include <stdexcept>
#include <string>
namespace tools
{
void log_stack_trace(const char *msg);
class exception: public std::exception {
public:
exception() { log_stack_trace(what()); }
};
class runtime_error: public std::runtime_error {
public:
explicit runtime_error(const std::string &s): std::runtime_error(s) { log_stack_trace(what()); }
explicit runtime_error(const char *s): std::runtime_error(s) { log_stack_trace(what()); }
};
} // namespace tools
#endif

View File

@ -41,7 +41,6 @@
#include "syncobj.h" #include "syncobj.h"
#include "string_tools.h" #include "string_tools.h"
#include "common/exception.h"
#include "tx_pool.h" #include "tx_pool.h"
#include "cryptonote_basic.h" #include "cryptonote_basic.h"
#include "common/util.h" #include "common/util.h"
@ -315,7 +314,7 @@ namespace cryptonote
"m_invalid_blocks: " << m_invalid_blocks.size() << ENDL << "m_invalid_blocks: " << m_invalid_blocks.size() << ENDL <<
"m_current_block_cumul_sz_limit: " << m_current_block_cumul_sz_limit); "m_current_block_cumul_sz_limit: " << m_current_block_cumul_sz_limit);
throw tools::runtime_error("Blockchain data corruption"); throw std::runtime_error("Blockchain data corruption");
} }
} }
} }

View File

@ -28,7 +28,6 @@
// //
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "common/exception.h"
#include "checkpoints_create.h" #include "checkpoints_create.h"
#include "common/dns_utils.h" #include "common/dns_utils.h"
#include "include_base_utils.h" #include "include_base_utils.h"

View File

@ -161,7 +161,7 @@ namespace cryptonote
cryptonote::checkpoints checkpoints; cryptonote::checkpoints checkpoints;
if (!cryptonote::create_checkpoints(checkpoints)) if (!cryptonote::create_checkpoints(checkpoints))
{ {
throw tools::runtime_error("Failed to initialize checkpoints"); throw std::runtime_error("Failed to initialize checkpoints");
} }
set_checkpoints(std::move(checkpoints)); set_checkpoints(std::move(checkpoints));

View File

@ -36,7 +36,6 @@
#include <boost/program_options/variables_map.hpp> #include <boost/program_options/variables_map.hpp>
#include <boost/interprocess/sync/file_lock.hpp> #include <boost/interprocess/sync/file_lock.hpp>
#include <common/exception.h>
#include "p2p/net_node_common.h" #include "p2p/net_node_common.h"
#include "cryptonote_protocol/cryptonote_protocol_handler_common.h" #include "cryptonote_protocol/cryptonote_protocol_handler_common.h"
#include "storages/portable_storage_template_helper.h" #include "storages/portable_storage_template_helper.h"

View File

@ -34,7 +34,6 @@
#include <boost/interprocess/detail/atomic.hpp> #include <boost/interprocess/detail/atomic.hpp>
#include <boost/limits.hpp> #include <boost/limits.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "common/exception.h"
#include "misc_language.h" #include "misc_language.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "cryptonote_basic_impl.h" #include "cryptonote_basic_impl.h"

View File

@ -38,7 +38,6 @@
#include <string> #include <string>
#include <ctime> #include <ctime>
#include "common/exception.h"
#include "storages/levin_abstract_invoke2.h" #include "storages/levin_abstract_invoke2.h"
#include "warnings.h" #include "warnings.h"
#include "cryptonote_protocol_defs.h" #include "cryptonote_protocol_defs.h"

View File

@ -26,7 +26,6 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/exception.h"
#include "cryptonote_core/cryptonote_basic_impl.h" #include "cryptonote_core/cryptonote_basic_impl.h"
#include "daemon/command_parser_executor.h" #include "daemon/command_parser_executor.h"

View File

@ -26,7 +26,6 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/exception.h"
#include "cryptonote_config.h" #include "cryptonote_config.h"
#include "version.h" #include "version.h"
#include "daemon/command_server.h" #include "daemon/command_server.h"

View File

@ -110,7 +110,7 @@ bool t_daemon::run(bool interactive)
{ {
if (nullptr == mp_internals) if (nullptr == mp_internals)
{ {
throw tools::runtime_error{"Can't run stopped daemon"}; throw std::runtime_error{"Can't run stopped daemon"};
} }
tools::signal_handler::install(std::bind(&daemonize::t_daemon::stop_p2p, this)); tools::signal_handler::install(std::bind(&daemonize::t_daemon::stop_p2p, this));
@ -155,7 +155,7 @@ void t_daemon::stop()
{ {
if (nullptr == mp_internals) if (nullptr == mp_internals)
{ {
throw tools::runtime_error{"Can't stop stopped daemon"}; throw std::runtime_error{"Can't stop stopped daemon"};
} }
mp_internals->p2p.stop(); mp_internals->p2p.stop();
mp_internals->rpc.stop(); mp_internals->rpc.stop();
@ -166,7 +166,7 @@ void t_daemon::stop_p2p()
{ {
if (nullptr == mp_internals) if (nullptr == mp_internals)
{ {
throw tools::runtime_error{"Can't send stop signal to a stopped daemon"}; throw std::runtime_error{"Can't send stop signal to a stopped daemon"};
} }
mp_internals->p2p.get().send_stop_signal(); mp_internals->p2p.get().send_stop_signal();
} }

View File

@ -60,7 +60,7 @@ public:
LOG_PRINT_L0("Initializing p2p server..."); LOG_PRINT_L0("Initializing p2p server...");
if (!m_server.init(vm)) if (!m_server.init(vm))
{ {
throw tools::runtime_error("Failed to initialize p2p server."); throw std::runtime_error("Failed to initialize p2p server.");
} }
LOG_PRINT_L0("P2p server initialized OK"); LOG_PRINT_L0("P2p server initialized OK");
} }

View File

@ -50,7 +50,7 @@ public:
LOG_PRINT_L0("Initializing cryptonote protocol..."); LOG_PRINT_L0("Initializing cryptonote protocol...");
if (!m_protocol.init(vm)) if (!m_protocol.init(vm))
{ {
throw tools::runtime_error("Failed to initialize cryptonote protocol."); throw std::runtime_error("Failed to initialize cryptonote protocol.");
} }
LOG_PRINT_L0("Cryptonote protocol initialized OK"); LOG_PRINT_L0("Cryptonote protocol initialized OK");
} }

View File

@ -55,7 +55,7 @@ public:
LOG_PRINT_L0("Initializing core rpc server..."); LOG_PRINT_L0("Initializing core rpc server...");
if (!m_server.init(vm)) if (!m_server.init(vm))
{ {
throw tools::runtime_error("Failed to initialize core rpc server."); throw std::runtime_error("Failed to initialize core rpc server.");
} }
LOG_PRINT_GREEN("Core rpc server initialized OK on port: " << m_server.get_binded_port(), LOG_LEVEL_0); LOG_PRINT_GREEN("Core rpc server initialized OK on port: " << m_server.get_binded_port(), LOG_LEVEL_0);
} }
@ -65,7 +65,7 @@ public:
LOG_PRINT_L0("Starting core rpc server..."); LOG_PRINT_L0("Starting core rpc server...");
if (!m_server.run(2, false)) if (!m_server.run(2, false))
{ {
throw tools::runtime_error("Failed to start core rpc server."); throw std::runtime_error("Failed to start core rpc server.");
} }
LOG_PRINT_L0("Core rpc server started ok"); LOG_PRINT_L0("Core rpc server started ok");
} }

View File

@ -28,7 +28,6 @@
// //
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "common/exception.h"
#include "string_tools.h" #include "string_tools.h"
#include "common/scoped_message_writer.h" #include "common/scoped_message_writer.h"
#include "daemon/rpc_command_executor.h" #include "daemon/rpc_command_executor.h"
@ -89,7 +88,7 @@ t_rpc_command_executor::t_rpc_command_executor(
{ {
if (rpc_server == NULL) if (rpc_server == NULL)
{ {
throw tools::runtime_error("If not calling commands via RPC, rpc_server pointer must be non-null"); throw std::runtime_error("If not calling commands via RPC, rpc_server pointer must be non-null");
} }
} }

View File

@ -4,7 +4,6 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
#include "common/exception.h"
#include "daemonizer/posix_fork.h" #include "daemonizer/posix_fork.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
@ -21,7 +20,7 @@ namespace {
void quit(std::string const & message) void quit(std::string const & message)
{ {
LOG_ERROR(message); LOG_ERROR(message);
throw tools::runtime_error(message); throw std::runtime_error(message);
} }
} }

View File

@ -28,7 +28,6 @@
// //
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "common/exception.h"
#include "common/command_line.h" #include "common/command_line.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "simpleminer.h" #include "simpleminer.h"

View File

@ -33,7 +33,6 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <chrono> #include <chrono>
#include "common/exception.h"
#include "../../contrib/otshell_utils/utils.hpp" #include "../../contrib/otshell_utils/utils.hpp"
namespace epee namespace epee
@ -44,7 +43,7 @@ namespace net_utils
boost::call_once(m_singleton, boost::call_once(m_singleton,
[] { [] {
_info_c("dbg/data","Creating singleton of data_logger"); _info_c("dbg/data","Creating singleton of data_logger");
if (m_state != data_logger_state::state_before_init) { _erro_c("dbg/data","Internal error in singleton"); throw tools::runtime_error("data_logger singleton"); } if (m_state != data_logger_state::state_before_init) { _erro_c("dbg/data","Internal error in singleton"); throw std::runtime_error("data_logger singleton"); }
m_state = data_logger_state::state_during_init; m_state = data_logger_state::state_during_init;
m_obj.reset(new data_logger()); m_obj.reset(new data_logger());
m_state = data_logger_state::state_ready_to_use; m_state = data_logger_state::state_ready_to_use;
@ -53,7 +52,7 @@ namespace net_utils
if (m_state != data_logger_state::state_ready_to_use) { if (m_state != data_logger_state::state_ready_to_use) {
_erro ("trying to use not working data_logger"); _erro ("trying to use not working data_logger");
throw tools::runtime_error("data_logger ctor state"); throw std::runtime_error("data_logger ctor state");
} }
return * m_obj; return * m_obj;
@ -61,7 +60,7 @@ namespace net_utils
data_logger::data_logger() { data_logger::data_logger() {
_note_c("dbg/data","Starting data logger (for graphs data)"); _note_c("dbg/data","Starting data logger (for graphs data)");
if (m_state != data_logger_state::state_during_init) { _erro_c("dbg/data","Singleton ctor state"); throw tools::runtime_error("data_logger ctor state"); } if (m_state != data_logger_state::state_during_init) { _erro_c("dbg/data","Singleton ctor state"); throw std::runtime_error("data_logger ctor state"); }
boost::lock_guard<boost::mutex> lock(mMutex); // lock boost::lock_guard<boost::mutex> lock(mMutex); // lock
// prepare all the files for given data channels: // prepare all the files for given data channels:

View File

@ -561,7 +561,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
{ {
if (args.empty()) if (args.empty())
{ {
fail_msg_writer() << tr("set: needs an argument. available options: seed, always-confirm-transfers, store-tx-info, default-mixin, auto-refresh, refresh-type"); fail_msg_writer() << tr("set: needs an argument. available options: seed, always-confirm-transfers, default-mixin, auto-refresh, refresh-type");
return true; return true;
} }
else else

View File

@ -32,7 +32,6 @@
#include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_iarchive.hpp>
#include <boost/utility/value_init.hpp> #include <boost/utility/value_init.hpp>
#include "common/exception.h"
#include "include_base_utils.h" #include "include_base_utils.h"
using namespace epee; using namespace epee;
@ -804,7 +803,7 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re
// handle error from async fetching thread // handle error from async fetching thread
if (error) if (error)
{ {
throw tools::runtime_error("proxy exception in refresh thread"); throw std::runtime_error("proxy exception in refresh thread");
} }
} }
catch (const std::exception&) catch (const std::exception&)
@ -2013,7 +2012,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<crypto
// Throw if split_amounts comes back with a vector of size different than it should // Throw if split_amounts comes back with a vector of size different than it should
if (split_values.size() != num_tx) if (split_values.size() != num_tx)
{ {
throw tools::runtime_error("Splitting transactions returned a number of potential tx not equal to what was requested"); throw std::runtime_error("Splitting transactions returned a number of potential tx not equal to what was requested");
} }
std::vector<pending_tx> ptx_vector; std::vector<pending_tx> ptx_vector;

View File

@ -35,7 +35,6 @@
#include <boost/serialization/vector.hpp> #include <boost/serialization/vector.hpp>
#include <atomic> #include <atomic>
#include "common/exception.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "cryptonote_core/account.h" #include "cryptonote_core/account.h"
#include "cryptonote_core/account_boost_serialization.h" #include "cryptonote_core/account_boost_serialization.h"

View File

@ -28,7 +28,6 @@
// //
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "common/exception.h"
#include "wallet2_api.h" #include "wallet2_api.h"
#include "wallet2.h" #include "wallet2.h"
#include "mnemonics/electrum-words.h" #include "mnemonics/electrum-words.h"

View File

@ -82,7 +82,7 @@ namespace tests
bool on_idle(){return true;} bool on_idle(){return true;}
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;} bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;}
bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;} bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;}
cryptonote::blockchain_storage &get_blockchain_storage() { throw tools::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class proxy_core."); } cryptonote::blockchain_storage &get_blockchain_storage() { throw std::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class proxy_core."); }
bool get_test_drop_download() {return true;} bool get_test_drop_download() {return true;}
bool get_test_drop_download_height() {return true;} bool get_test_drop_download_height() {return true;}
bool prepare_handle_incoming_blocks(const std::list<cryptonote::block_complete_entry> &blocks) { return true; } bool prepare_handle_incoming_blocks(const std::list<cryptonote::block_complete_entry> &blocks) { return true; }

View File

@ -58,7 +58,7 @@ void test_generator::get_block_chain(std::vector<block_info>& blockchain, const
auto it = m_blocks_info.find(curr); auto it = m_blocks_info.find(curr);
if (m_blocks_info.end() == it) if (m_blocks_info.end() == it)
{ {
throw tools::runtime_error("block hash wasn't found"); throw std::runtime_error("block hash wasn't found");
} }
blockchain.push_back(it->second); blockchain.push_back(it->second);
@ -82,7 +82,7 @@ uint64_t test_generator::get_already_generated_coins(const crypto::hash& blk_id)
{ {
auto it = m_blocks_info.find(blk_id); auto it = m_blocks_info.find(blk_id);
if (it == m_blocks_info.end()) if (it == m_blocks_info.end())
throw tools::runtime_error("block hash wasn't found"); throw std::runtime_error("block hash wasn't found");
return it->second.already_generated_coins; return it->second.already_generated_coins;
} }
@ -323,7 +323,7 @@ bool init_output_indices(map_output_idx_t& outs, std::map<uint64_t, std::vector<
BOOST_FOREACH(const crypto::hash &h, blk.tx_hashes) { BOOST_FOREACH(const crypto::hash &h, blk.tx_hashes) {
const map_hash2tx_t::const_iterator cit = mtx.find(h); const map_hash2tx_t::const_iterator cit = mtx.find(h);
if (mtx.end() == cit) if (mtx.end() == cit)
throw tools::runtime_error("block contains an unknown tx hash"); throw std::runtime_error("block contains an unknown tx hash");
vtx.push_back(cit->second); vtx.push_back(cit->second);
} }
@ -486,11 +486,11 @@ void fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
destinations.clear(); destinations.clear();
if (!fill_tx_sources(sources, events, blk_head, from, amount + fee, nmix)) if (!fill_tx_sources(sources, events, blk_head, from, amount + fee, nmix))
throw tools::runtime_error("couldn't fill transaction sources"); throw std::runtime_error("couldn't fill transaction sources");
tx_destination_entry de; tx_destination_entry de;
if (!fill_tx_destination(de, to, amount)) if (!fill_tx_destination(de, to, amount))
throw tools::runtime_error("couldn't fill transaction destination"); throw std::runtime_error("couldn't fill transaction destination");
destinations.push_back(de); destinations.push_back(de);
tx_destination_entry de_change; tx_destination_entry de_change;
@ -498,7 +498,7 @@ void fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
if (0 < cache_back) if (0 < cache_back)
{ {
if (!fill_tx_destination(de_change, from, cache_back)) if (!fill_tx_destination(de_change, from, cache_back))
throw tools::runtime_error("couldn't fill transaction cache back destination"); throw std::runtime_error("couldn't fill transaction cache back destination");
destinations.push_back(de_change); destinations.push_back(de_change);
} }
} }

View File

@ -284,7 +284,7 @@ bool do_check_tx_verification_context(const cryptonote::tx_verification_context&
{ {
// Default block verification context check // Default block verification context check
if (tvc.m_verifivation_failed) if (tvc.m_verifivation_failed)
throw tools::runtime_error("Transaction verification failed"); throw std::runtime_error("Transaction verification failed");
return true; return true;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -307,7 +307,7 @@ bool do_check_block_verification_context(const cryptonote::block_verification_co
{ {
// Default block verification context check // Default block verification context check
if (bvc.m_verifivation_failed) if (bvc.m_verifivation_failed)
throw tools::runtime_error("Block verification failed"); throw std::runtime_error("Block verification failed");
return true; return true;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -621,7 +621,7 @@ inline bool do_replay_file(const std::string& filename)
if (!tools::serialize_obj_to_file(events, filename)) \ if (!tools::serialize_obj_to_file(events, filename)) \
{ \ { \
std::cout << concolor::magenta << "Failed to serialize data to file: " << filename << concolor::normal << std::endl; \ std::cout << concolor::magenta << "Failed to serialize data to file: " << filename << concolor::normal << std::endl; \
throw tools::runtime_error("Failed to serialize data to file"); \ throw std::runtime_error("Failed to serialize data to file"); \
} \ } \
} }

View File

@ -156,7 +156,7 @@ namespace
} }
} }
throw tools::runtime_error("invalid public key wasn't found"); throw std::runtime_error("invalid public key wasn't found");
return crypto::public_key(); return crypto::public_key();
} }
} }

View File

@ -37,7 +37,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "common/exception.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "misc_language.h" #include "misc_language.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"

View File

@ -31,7 +31,6 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include "common/exception.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "storages/levin_abstract_invoke2.h" #include "storages/levin_abstract_invoke2.h"

View File

@ -56,7 +56,7 @@ public:
bool on_idle(){return true;} bool on_idle(){return true;}
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;} bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;}
bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;} bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;}
cryptonote::blockchain_storage &get_blockchain_storage() { throw tools::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class test_core."); } cryptonote::blockchain_storage &get_blockchain_storage() { throw std::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class test_core."); }
bool get_test_drop_download() const {return true;} bool get_test_drop_download() const {return true;}
bool get_test_drop_download_height() const {return true;} bool get_test_drop_download_height() const {return true;}
bool prepare_handle_incoming_blocks(const std::list<cryptonote::block_complete_entry> &blocks) { return true; } bool prepare_handle_incoming_blocks(const std::list<cryptonote::block_complete_entry> &blocks) { return true; }

View File

@ -104,7 +104,7 @@ TEST(boosted_tcp_server, worker_threads_are_exception_resistant)
// 2 theads, but 4 exceptions // 2 theads, but 4 exceptions
ASSERT_TRUE(srv.run_server(2, false)); ASSERT_TRUE(srv.run_server(2, false));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw tools::runtime_error("test 1"); })); ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::runtime_error("test 1"); }));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::string("test 2"); })); ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::string("test 2"); }));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw "test 3"; })); ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw "test 3"; }));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw 4; })); ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw 4; }));

View File

@ -27,7 +27,6 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "common/exception.h"
#include "mnemonics/electrum-words.h" #include "mnemonics/electrum-words.h"
#include "crypto/crypto.h" #include "crypto/crypto.h"
#include <stdlib.h> #include <stdlib.h>

View File

@ -30,7 +30,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "common/exception.h"
#include "include_base_utils.h" #include "include_base_utils.h"
#include "cryptonote_protocol/cryptonote_protocol_defs.h" #include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "storages/portable_storage_template_helper.h" #include "storages/portable_storage_template_helper.h"