diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-22 19:38:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-22 19:38:46 +0800 |
commit | a95f057e37b746359a7426e95da32e3236f0603a (patch) | |
tree | e7c7b00393570752b461cbf768fa0ea53e18fee5 /libdevcore/CommonIO.cpp | |
parent | de7a488f82217118d698f4cd6028826f12cbad8b (diff) | |
parent | d5f8ce90c7a76870e5a9d0fe6f9fd709a7383572 (diff) | |
download | dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.tar dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.tar.gz dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.tar.bz2 dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.tar.lz dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.tar.xz dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.tar.zst dexon-solidity-a95f057e37b746359a7426e95da32e3236f0603a.zip |
Merge pull request #2438 from ethereum/exceptions-cleanup
Cleanup assertions/exceptions includes
Diffstat (limited to 'libdevcore/CommonIO.cpp')
-rw-r--r-- | libdevcore/CommonIO.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
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 (...) + { + } } } |