diff options
Diffstat (limited to 'libdevcore')
-rw-r--r-- | libdevcore/Assertions.h | 2 | ||||
-rw-r--r-- | libdevcore/Common.h | 2 | ||||
-rw-r--r-- | libdevcore/CommonIO.cpp | 23 | ||||
-rw-r--r-- | libdevcore/Exceptions.h | 4 |
4 files changed, 17 insertions, 14 deletions
diff --git a/libdevcore/Assertions.h b/libdevcore/Assertions.h index 0151cfc1..729ffb05 100644 --- a/libdevcore/Assertions.h +++ b/libdevcore/Assertions.h @@ -54,6 +54,4 @@ namespace dev } \ while (false) -using errinfo_comment = boost::error_info<struct tag_comment, std::string>; - } diff --git a/libdevcore/Common.h b/libdevcore/Common.h index dc981ff6..c5b09a80 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -76,8 +76,6 @@ using byte = uint8_t; #define DEV_QUOTED_HELPER(s) #s #define DEV_QUOTED(s) DEV_QUOTED_HELPER(s) -#define DEV_IGNORE_EXCEPTIONS(X) try { X; } catch (...) {} - namespace dev { diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index 8dbcb00a..52829455 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -30,11 +30,11 @@ #include <termios.h> #endif #include <boost/filesystem.hpp> -#include "Exceptions.h" +#include "Assertions.h" + using namespace std; using namespace dev; - template <typename _T> inline _T contentsGeneric(std::string const& _file) { @@ -78,13 +78,24 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe if (!fs::exists(p.parent_path())) { fs::create_directories(p.parent_path()); - DEV_IGNORE_EXCEPTIONS(fs::permissions(p.parent_path(), fs::owner_all)); + try + { + fs::permissions(p.parent_path(), fs::owner_all); + } + catch (...) + { + } } ofstream s(_file, ios::trunc | ios::binary); s.write(reinterpret_cast<char const*>(_data.data()), _data.size()); - if (!s) - BOOST_THROW_EXCEPTION(FileError() << errinfo_comment("Could not write to file: " + _file)); - DEV_IGNORE_EXCEPTIONS(fs::permissions(_file, fs::owner_read|fs::owner_write)); + assertThrow(s, FileError, "Could not write to file: " + _file); + try + { + fs::permissions(_file, fs::owner_read|fs::owner_write); + } + catch (...) + { + } } } diff --git a/libdevcore/Exceptions.h b/libdevcore/Exceptions.h index 37cdbed9..4817e9e3 100644 --- a/libdevcore/Exceptions.h +++ b/libdevcore/Exceptions.h @@ -56,9 +56,5 @@ DEV_SIMPLE_EXCEPTION(FileError); // error information to be added to exceptions using errinfo_invalidSymbol = boost::error_info<struct tag_invalidSymbol, char>; using errinfo_comment = boost::error_info<struct tag_comment, std::string>; -using errinfo_required = boost::error_info<struct tag_required, bigint>; -using errinfo_got = boost::error_info<struct tag_got, bigint>; -using errinfo_required_h256 = boost::error_info<struct tag_required_h256, h256>; -using errinfo_got_h256 = boost::error_info<struct tag_get_h256, h256>; } |