diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-16 18:16:01 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-22 18:25:06 +0800 |
commit | becea47ac3066c7d8d448d0e428cd84d351061e3 (patch) | |
tree | d45a203568ccd99ecb66620872440dd1f29403a7 | |
parent | 1c54ce2a2caa6c4d91091152ad8a52b7881e8b83 (diff) | |
download | dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.tar dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.tar.gz dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.tar.bz2 dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.tar.lz dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.tar.xz dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.tar.zst dexon-solidity-becea47ac3066c7d8d448d0e428cd84d351061e3.zip |
Use assertThrow where possible
-rw-r--r-- | libdevcore/CommonIO.cpp | 7 | ||||
-rw-r--r-- | libevmasm/Assembly.cpp | 13 |
2 files changed, 8 insertions, 12 deletions
diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index 8dbcb00a..97505b54 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) { @@ -83,8 +83,7 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe 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)); + assertThrow(s, FileError, "Could not write to file: " + _file); DEV_IGNORE_EXCEPTIONS(fs::permissions(_file, fs::owner_read|fs::owner_write)); } } diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 606714d2..27199b7b 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -59,14 +59,11 @@ void Assembly::append(Assembly const& _a) void Assembly::append(Assembly const& _a, int _deposit) { - if (_deposit > _a.m_deposit) - BOOST_THROW_EXCEPTION(InvalidDeposit()); - else - { - append(_a); - while (_deposit++ < _a.m_deposit) - append(Instruction::POP); - } + assertThrow(_deposit <= _a.m_deposit, InvalidDeposit, ""); + + append(_a); + while (_deposit++ < _a.m_deposit) + append(Instruction::POP); } unsigned Assembly::bytesRequired(unsigned subTagSize) const |