Exceptions.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. This file is part of cpp-ethereum.
  3. cpp-ethereum is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. cpp-ethereum is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /** @file Exceptions.h
  15. * @author Gav Wood <i@gavwood.com>
  16. * @date 2014
  17. */
  18. #pragma once
  19. #include <libdevcore/Exceptions.h>
  20. #include "Common.h"
  21. namespace dev
  22. {
  23. namespace eth
  24. {
  25. // information to add to exceptions
  26. using errinfo_name = boost::error_info<struct tag_field, std::string>;
  27. using errinfo_field = boost::error_info<struct tag_field, int>;
  28. using errinfo_data = boost::error_info<struct tag_data, std::string>;
  29. using errinfo_nonce = boost::error_info<struct tag_nonce, h64>;
  30. using errinfo_difficulty = boost::error_info<struct tag_difficulty, u256>;
  31. using errinfo_target = boost::error_info<struct tag_target, h256>;
  32. using errinfo_seedHash = boost::error_info<struct tag_seedHash, h256>;
  33. using errinfo_mixHash = boost::error_info<struct tag_mixHash, h256>;
  34. using errinfo_ethashResult = boost::error_info<struct tag_ethashResult, std::tuple<h256, h256>>;
  35. using BadFieldError = boost::tuple<errinfo_field, errinfo_data>;
  36. DEV_SIMPLE_EXCEPTION(OutOfGasBase);
  37. DEV_SIMPLE_EXCEPTION(OutOfGasIntrinsic);
  38. DEV_SIMPLE_EXCEPTION(NotEnoughAvailableSpace);
  39. DEV_SIMPLE_EXCEPTION(NotEnoughCash);
  40. DEV_SIMPLE_EXCEPTION(GasPriceTooLow);
  41. DEV_SIMPLE_EXCEPTION(BlockGasLimitReached);
  42. DEV_SIMPLE_EXCEPTION(FeeTooSmall);
  43. DEV_SIMPLE_EXCEPTION(TooMuchGasUsed);
  44. DEV_SIMPLE_EXCEPTION(ExtraDataTooBig);
  45. DEV_SIMPLE_EXCEPTION(ExtraDataIncorrect);
  46. DEV_SIMPLE_EXCEPTION(InvalidSignature);
  47. DEV_SIMPLE_EXCEPTION(InvalidTransactionFormat);
  48. DEV_SIMPLE_EXCEPTION(InvalidBlockFormat);
  49. DEV_SIMPLE_EXCEPTION(InvalidUnclesHash);
  50. DEV_SIMPLE_EXCEPTION(TooManyUncles);
  51. DEV_SIMPLE_EXCEPTION(UncleTooOld);
  52. DEV_SIMPLE_EXCEPTION(UncleIsBrother);
  53. DEV_SIMPLE_EXCEPTION(UncleInChain);
  54. DEV_SIMPLE_EXCEPTION(UncleParentNotInChain);
  55. DEV_SIMPLE_EXCEPTION(InvalidStateRoot);
  56. DEV_SIMPLE_EXCEPTION(InvalidGasUsed);
  57. DEV_SIMPLE_EXCEPTION(InvalidTransactionsRoot);
  58. DEV_SIMPLE_EXCEPTION(InvalidDifficulty);
  59. DEV_SIMPLE_EXCEPTION(InvalidGasLimit);
  60. DEV_SIMPLE_EXCEPTION(InvalidReceiptsStateRoot);
  61. DEV_SIMPLE_EXCEPTION(InvalidTimestamp);
  62. DEV_SIMPLE_EXCEPTION(InvalidLogBloom);
  63. DEV_SIMPLE_EXCEPTION(InvalidNonce);
  64. DEV_SIMPLE_EXCEPTION(InvalidBlockHeaderItemCount);
  65. DEV_SIMPLE_EXCEPTION(InvalidBlockNonce);
  66. DEV_SIMPLE_EXCEPTION(InvalidParentHash);
  67. DEV_SIMPLE_EXCEPTION(InvalidUncleParentHash);
  68. DEV_SIMPLE_EXCEPTION(InvalidNumber);
  69. DEV_SIMPLE_EXCEPTION(BlockNotFound);
  70. DEV_SIMPLE_EXCEPTION(UnknownParent);
  71. DEV_SIMPLE_EXCEPTION(DatabaseAlreadyOpen);
  72. DEV_SIMPLE_EXCEPTION(DAGCreationFailure);
  73. DEV_SIMPLE_EXCEPTION(DAGComputeFailure);
  74. }
  75. }