TARAXA
Loading...
Searching...
No Matches
Exceptions.h
Go to the documentation of this file.
1// Aleth: Ethereum C++ client, tools and libraries.
2// Copyright 2014-2019 Aleth Authors.
3// Licensed under the GNU General Public License, Version 3.
4
5#pragma once
6
7#include <boost/exception/diagnostic_information.hpp>
8#include <boost/exception/errinfo_api_function.hpp>
9#include <boost/exception/exception.hpp>
10#include <boost/exception/info.hpp>
11#include <boost/exception/info_tuple.hpp>
12#include <boost/throw_exception.hpp>
13#include <boost/tuple/tuple.hpp>
14#include <exception>
15#include <string>
16
17#include "FixedHash.h"
18
19namespace dev {
21struct Exception : virtual std::exception, virtual boost::exception {
22 const char* what() const noexcept override { return boost::diagnostic_information_what(*this); }
23};
24
25#define DEV_SIMPLE_EXCEPTION(X) \
26 struct X : virtual ::dev::Exception {}
27
29struct RLPException : virtual Exception {};
30#define DEV_SIMPLE_EXCEPTION_RLP(X) \
31 struct X : virtual ::dev::RLPException {}
32
37
53
54// error information to be added to exceptions
55using errinfo_invalidSymbol = boost::error_info<struct tag_invalidSymbol, char>;
56using errinfo_wrongAddress = boost::error_info<struct tag_address, std::string>;
57using errinfo_comment = boost::error_info<struct tag_comment, std::string>;
58using errinfo_required = boost::error_info<struct tag_required, bigint>;
59using errinfo_got = boost::error_info<struct tag_got, bigint>;
60using errinfo_min = boost::error_info<struct tag_min, bigint>;
61using errinfo_max = boost::error_info<struct tag_max, bigint>;
62using RequirementError = boost::tuple<errinfo_required, errinfo_got>;
63using RequirementErrorComment = boost::tuple<errinfo_required, errinfo_got, errinfo_comment>;
64using errinfo_hash256 = boost::error_info<struct tag_hash, h256>;
65using errinfo_required_h256 = boost::error_info<struct tag_required_h256, h256>;
66using errinfo_got_h256 = boost::error_info<struct tag_get_h256, h256>;
67using Hash256RequirementError = boost::tuple<errinfo_required_h256, errinfo_got_h256>;
68using errinfo_extraData = boost::error_info<struct tag_extraData, bytes>;
69using errinfo_externalFunction = boost::errinfo_api_function;
70using errinfo_interface = boost::error_info<struct tag_interface, std::string>;
71using errinfo_path = boost::error_info<struct tag_path, std::string>;
72using errinfo_nodeID = boost::error_info<struct tag_nodeID, h512>;
73} // namespace dev
#define DEV_SIMPLE_EXCEPTION_RLP(X)
Definition Exceptions.h:30
#define DEV_SIMPLE_EXCEPTION(X)
Definition Exceptions.h:25
Definition Address.h:13
boost::error_info< struct tag_hash, h256 > errinfo_hash256
Definition Exceptions.h:64
boost::tuple< errinfo_required, errinfo_got > RequirementError
Definition Exceptions.h:62
boost::error_info< struct tag_address, std::string > errinfo_wrongAddress
Definition Exceptions.h:56
void assertThrowAux(bool _condition, ::std::string const &_errorDescription, unsigned _line, char const *_file, char const *_function)
Definition Assertions.h:53
boost::error_info< struct tag_min, bigint > errinfo_min
Definition Exceptions.h:60
boost::error_info< struct tag_required_h256, h256 > errinfo_required_h256
Definition Exceptions.h:65
boost::error_info< struct tag_path, std::string > errinfo_path
Definition Exceptions.h:71
boost::tuple< errinfo_required_h256, errinfo_got_h256 > Hash256RequirementError
Definition Exceptions.h:67
boost::error_info< struct tag_required, bigint > errinfo_required
Definition Exceptions.h:58
boost::error_info< struct tag_comment, std::string > errinfo_comment
Definition Assertions.h:50
boost::error_info< struct tag_interface, std::string > errinfo_interface
Definition Exceptions.h:70
boost::errinfo_api_function errinfo_externalFunction
Definition Exceptions.h:69
boost::error_info< struct tag_extraData, bytes > errinfo_extraData
Definition Exceptions.h:68
boost::error_info< struct tag_max, bigint > errinfo_max
Definition Exceptions.h:61
boost::error_info< struct tag_invalidSymbol, char > errinfo_invalidSymbol
Definition Exceptions.h:55
boost::error_info< struct tag_got, bigint > errinfo_got
Definition Exceptions.h:59
boost::error_info< struct tag_get_h256, h256 > errinfo_got_h256
Definition Exceptions.h:66
boost::error_info< struct tag_nodeID, h512 > errinfo_nodeID
Definition Exceptions.h:72
boost::tuple< errinfo_required, errinfo_got, errinfo_comment > RequirementErrorComment
Definition Exceptions.h:63
Base class for all exceptions.
Definition Exceptions.h:21
const char * what() const noexcept override
Definition Exceptions.h:22
Base class for all RLP exceptions.
Definition Exceptions.h:29