diff --git a/src/core/storage/fileio/fs_utils.cpp b/src/core/storage/fileio/fs_utils.cpp index b249fb5b69..78af3dcbab 100644 --- a/src/core/storage/fileio/fs_utils.cpp +++ b/src/core/storage/fileio/fs_utils.cpp @@ -41,7 +41,7 @@ EXPORT std::string make_canonical_path(const std::string& path) { } else { return fs::canonical(fs::absolute(p)).string(); } - } catch (fs::filesystem_error e) { + } catch (const fs::filesystem_error& e) { log_and_throw(std::string("Invalid path: ") + path + ". " + e.what()); } } diff --git a/src/core/storage/fileio/general_fstream.cpp b/src/core/storage/fileio/general_fstream.cpp index e14e69d9c0..83a957ab30 100644 --- a/src/core/storage/fileio/general_fstream.cpp +++ b/src/core/storage/fileio/general_fstream.cpp @@ -91,7 +91,7 @@ general_ofstream::general_ofstream(std::string filename, bool gzip_compress) try : general_ofstream_base(filename, gzip_compress), opened_filename(filename) { exceptions(std::ios_base::badbit); -} catch (std::exception e) { +} catch (const std::exception& e) { log_and_throw_io_failure("Cannot open " + sanitize_url(filename) + " for write. " + e.what()); } catch (std::string e) { diff --git a/src/core/storage/serialization/dir_archive.cpp b/src/core/storage/serialization/dir_archive.cpp index ba904d3daa..d99e5c1908 100644 --- a/src/core/storage/serialization/dir_archive.cpp +++ b/src/core/storage/serialization/dir_archive.cpp @@ -57,7 +57,7 @@ dir_archive_impl::archive_index_information read_index_file(std::string index_fi boost::property_tree::ptree data; try { boost::property_tree::ini_parser::read_ini(fin, data); - } catch(boost::property_tree::ini_parser_error e) { + } catch(boost::property_tree::ini_parser_error& e) { log_and_throw(std::string("Unable to parse archive index file ") + index_file); } diff --git a/src/core/storage/serialization/iarchive.hpp b/src/core/storage/serialization/iarchive.hpp index 48e59051be..daa6cab24d 100644 --- a/src/core/storage/serialization/iarchive.hpp +++ b/src/core/storage/serialization/iarchive.hpp @@ -117,7 +117,7 @@ namespace turi { template inline void read_into(T& c) { if (buf) { - memcpy(&c, buf + off, sizeof(T)); + memcpy(reinterpret_cast(&c), buf + off, sizeof(T)); off += sizeof(T); } else { in->read(reinterpret_cast(&c), sizeof(T)); diff --git a/src/core/storage/sframe_data/sframe_index_file.cpp b/src/core/storage/sframe_data/sframe_index_file.cpp index be8c26c04c..d6e55f93e1 100644 --- a/src/core/storage/sframe_data/sframe_index_file.cpp +++ b/src/core/storage/sframe_data/sframe_index_file.cpp @@ -28,7 +28,7 @@ sframe_index_file_information read_sframe_index_file(std::string index_file) { boost::property_tree::ptree data; try { boost::property_tree::ini_parser::read_ini(fin, data); - } catch(boost::property_tree::ini_parser_error e) { + } catch(const boost::property_tree::ini_parser_error& e) { log_and_throw(std::string("Unable to parse frame index file ") + index_file); } diff --git a/src/core/storage/sgraph_data/sgraph_triple_apply.cpp b/src/core/storage/sgraph_data/sgraph_triple_apply.cpp index fc24979ffa..ec9417ed83 100644 --- a/src/core/storage/sgraph_data/sgraph_triple_apply.cpp +++ b/src/core/storage/sgraph_data/sgraph_triple_apply.cpp @@ -854,7 +854,7 @@ namespace { g.get_vertex_fields(), g.get_edge_fields(), m_srcid_column, m_dstid_column); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw(lambda::reinterpret_comm_failure(e)); } @@ -943,7 +943,7 @@ namespace { try { mutated_edge_data = m_evaluator->proxy->eval_triple_apply(all_edge_data, m_src_partition, m_dst_partition, mutated_edge_field_ids); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw(lambda::reinterpret_comm_failure(e)); } diff --git a/src/core/system/lambda/lambda_master.cpp b/src/core/system/lambda/lambda_master.cpp index 93abe73638..7a795d402b 100644 --- a/src/core/system/lambda/lambda_master.cpp +++ b/src/core/system/lambda/lambda_master.cpp @@ -109,7 +109,7 @@ static lambda_master* instance_ptr = nullptr; auto release_lambda_fn = [lambda_hash](std::unique_ptr& proxy) { try { proxy->release_lambda(lambda_hash); - } catch (std::exception e){ + } catch (const std::exception& e){ logstream(LOG_ERROR) << "Error on releasing lambda: " << e.what() << std::endl; } catch (std::string e) { logstream(LOG_ERROR) << "Error on releasing lambda: " << e << std::endl; @@ -134,7 +134,7 @@ static lambda_master* instance_ptr = nullptr; // catch and reinterpret comm failure try { out = worker->proxy->bulk_eval(lambda_hash, args, skip_undefined, seed); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw reinterpret_comm_failure(e); } } @@ -236,7 +236,7 @@ static lambda_master* instance_ptr = nullptr; logstream(LOG_WARNING) << "Unexpected SHMIPC failure. Falling back to CPPIPC" << std::endl; } out = worker->proxy->bulk_eval_rows(lambda_hash, args, skip_undefined, seed); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw reinterpret_comm_failure(e); } } @@ -252,7 +252,7 @@ static lambda_master* instance_ptr = nullptr; // catch and reinterpret comm failure try { out = worker->proxy->bulk_eval_dict(lambda_hash, keys, values, skip_undefined, seed); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw reinterpret_comm_failure(e); } } @@ -289,7 +289,7 @@ static lambda_master* instance_ptr = nullptr; logstream(LOG_WARNING) << "Unexpected SHMIPC failure. Falling back to CPPIPC" << std::endl; } out = worker->proxy->bulk_eval_dict_rows(lambda_hash, keys, rows, skip_undefined, seed); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw reinterpret_comm_failure(e); } } diff --git a/src/core/system/lambda/worker_pool.hpp b/src/core/system/lambda/worker_pool.hpp index a421bfbb36..368d88c0af 100644 --- a/src/core/system/lambda/worker_pool.hpp +++ b/src/core/system/lambda/worker_pool.hpp @@ -385,7 +385,7 @@ class worker_pool { parallel_for(0, m_num_workers, [&](size_t i) { try { ret[i] = f(temp_workers[i]->proxy); - } catch (cppipc::ipcexception e) { + } catch (cppipc::ipcexception& e) { throw reinterpret_comm_failure(e); } });