BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
exceptions.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 BitShares Blockchain Foundation, and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
27 
28 namespace graphene { namespace chain {
29 
30  // Internal exceptions
31 
32  FC_IMPLEMENT_DERIVED_EXCEPTION( internal_exception, chain_exception, 3990000, "internal exception" )
33 
34  GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( verify_auth_max_auth_exceeded, 1, "Exceeds max authority fan-out" )
35  GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( verify_auth_account_not_found, 2, "Auth account not found" )
36 
37 
38  // Public exceptions
39 
40  FC_IMPLEMENT_EXCEPTION( chain_exception, 3000000, "blockchain exception" )
41 
42  FC_IMPLEMENT_DERIVED_EXCEPTION( database_query_exception, chain_exception, 3010000,
43  "database query exception" )
44  FC_IMPLEMENT_DERIVED_EXCEPTION( block_validate_exception, chain_exception, 3020000,
45  "block validation exception" )
47  "transaction processing exception" )
48  FC_IMPLEMENT_DERIVED_EXCEPTION( operation_validate_exception, chain_exception, 3040000,
49  "operation validation exception" )
50  FC_IMPLEMENT_DERIVED_EXCEPTION( operation_evaluate_exception, chain_exception, 3050000,
51  "operation evaluation exception" )
52  FC_IMPLEMENT_DERIVED_EXCEPTION( utility_exception, chain_exception, 3060000,
53  "utility method exception" )
54  FC_IMPLEMENT_DERIVED_EXCEPTION( undo_database_exception, chain_exception, 3070000,
55  "undo database exception" )
56  FC_IMPLEMENT_DERIVED_EXCEPTION( unlinkable_block_exception, chain_exception, 3080000, "unlinkable block" )
57  FC_IMPLEMENT_DERIVED_EXCEPTION( black_swan_exception, chain_exception, 3090000, "black swan" )
58  FC_IMPLEMENT_DERIVED_EXCEPTION( plugin_exception, chain_exception, 3100000, "plugin exception" )
59 
60  FC_IMPLEMENT_DERIVED_EXCEPTION( insufficient_feeds, chain_exception, 37006, "insufficient feeds" )
61 
63  "duplicate transaction" )
64 
65  FC_IMPLEMENT_DERIVED_EXCEPTION( pop_empty_chain, undo_database_exception, 3070001,
66  "there are no blocks to pop" )
67 
69  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( from_account_not_whitelisted, transfer, 1, "owner mismatch" )
70  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( to_account_not_whitelisted, transfer, 2, "owner mismatch" )
71  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( restricted_transfer_asset, transfer, 3, "restricted transfer asset" )
72 
75  "Killing limit order due to unable to fill" )
77  "The market has not been whitelisted by the selling asset" )
79  "The market has been blacklisted by the selling asset" )
80  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( selling_asset_unauthorized, limit_order_create, 4,
81  "The account is not allowed to transact the selling asset" )
82  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( receiving_asset_unauthorized, limit_order_create, 5,
83  "The account is not allowed to transact the receiving asset" )
85  "Insufficient balance" )
86 
87  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_update );
88  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( nonexist_order, limit_order_update, 1, "Order does not exist" )
89  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( owner_mismatch, limit_order_update, 2, "Order owned by someone else" )
90 
91  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_cancel );
92  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( nonexist_order, limit_order_cancel, 1, "Order does not exist" )
93  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( owner_mismatch, limit_order_cancel, 2, "Order owned by someone else" )
94 
95  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( call_order_update );
96  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unfilled_margin_call, call_order_update, 1,
97  "Updating call order would trigger a margin call that cannot be fully filled" )
98 
100  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_create, 1, "Exceeds max authority fan-out" )
101  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_create, 2, "Auth account not found" )
102  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_incorrect_issuer, account_create, 3,
103  "Incorrect issuer specified for account" )
105  "Cannot create buyback for asset which already has buyback" )
106  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_too_many_markets, account_create, 5, "Too many buyback markets" )
107 
108  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_update );
109  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_update, 1, "Exceeds max authority fan-out" )
110  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_update, 2, "Auth account not found" )
111 
112  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_whitelist );
113  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_upgrade );
114  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_transfer );
115  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_create );
116  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update );
117  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_bitasset );
118  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_feed_producers );
119  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_issue );
120 
121  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_reserve );
122  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( invalid_on_mia, asset_reserve, 1, "invalid on mia" )
123 
124  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_fund_fee_pool );
125  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_settle );
126  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_global_settle );
127  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_publish_feed );
128  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( committee_member_create );
129  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( witness_create );
130 
131  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_create );
132  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_required, proposal_create, 1, "review_period required" )
133  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_insufficient, proposal_create, 2,
134  "review_period insufficient" )
135 
136  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_update );
137  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_delete );
138  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_create );
139  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_update );
140  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_claim );
141  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_delete );
142  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( fill_order );
143  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( global_parameters_update );
144  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( vesting_balance_create );
145  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( vesting_balance_withdraw );
146  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( worker_create );
147  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( custom );
148  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( assert );
149 
150  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( balance_claim );
151  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( claimed_too_often, balance_claim, 1, "balance claimed too often" )
152  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( invalid_claim_amount, balance_claim, 2, "invalid claim amount" )
153  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( owner_mismatch, balance_claim, 3, "owner mismatch" )
154 
155  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( override_transfer );
156  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( not_permitted, override_transfer, 1, "not permitted" )
157 
158  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( blind_transfer );
159  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1,
160  "Attempting to claim an unknown prior commitment" );
161 
162  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( transfer_from_blind_operation )
163  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_claim_fees_operation )
164  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( bid_collateral_operation )
165  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_claim_pool_operation )
166  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_issuer_operation )
167  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_create_operation )
168  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_redeem_operation )
169  //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_extend_operation )
170 
171  GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( liquidity_pool_exchange );
172  GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unfillable_price, liquidity_pool_exchange, 1,
173  "Unable to exchange at expected price" );
174 
175  #define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \
176  catch( const cause_type& e ) \
177  { throw( effect_type( e.what(), e.get_log() ) ); }
178 
179 } } // graphene::chain
graphene::chain::GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION(kill_unfilled, limit_order_create, 1, "Killing limit order due to unable to fill") GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION(market_not_whitelisted
fc::typelist::at
typename impl::at< List, index >::type at
Get the type at the specified list index.
Definition: typelist.hpp:186
graphene::chain::database
tracks the blockchain state in an extensible manner
Definition: database.hpp:70
graphene::protocol::price
The price struct stores asset prices in the BitShares system.
Definition: asset.hpp:108
fc::static_variant< transfer_operation, limit_order_create_operation, limit_order_cancel_operation, call_order_update_operation, fill_order_operation, account_create_operation, account_update_operation, account_whitelist_operation, account_upgrade_operation, account_transfer_operation, asset_create_operation, asset_update_operation, asset_update_bitasset_operation, asset_update_feed_producers_operation, asset_issue_operation, asset_reserve_operation, asset_fund_fee_pool_operation, asset_settle_operation, asset_global_settle_operation, asset_publish_feed_operation, witness_create_operation, witness_update_operation, proposal_create_operation, proposal_update_operation, proposal_delete_operation, withdraw_permission_create_operation, withdraw_permission_update_operation, withdraw_permission_claim_operation, withdraw_permission_delete_operation, committee_member_create_operation, committee_member_update_operation, committee_member_update_global_parameters_operation, vesting_balance_create_operation, vesting_balance_withdraw_operation, worker_create_operation, custom_operation, assert_operation, balance_claim_operation, override_transfer_operation, transfer_to_blind_operation, blind_transfer_operation, transfer_from_blind_operation, asset_settle_cancel_operation, asset_claim_fees_operation, fba_distribute_operation, bid_collateral_operation, execute_bid_operation, asset_claim_pool_operation, asset_update_issuer_operation, htlc_create_operation, htlc_redeem_operation, htlc_redeemed_operation, htlc_extend_operation, htlc_refund_operation, custom_authority_create_operation, custom_authority_update_operation, custom_authority_delete_operation, ticket_create_operation, ticket_update_operation, liquidity_pool_create_operation, liquidity_pool_delete_operation, liquidity_pool_deposit_operation, liquidity_pool_withdraw_operation, liquidity_pool_exchange_operation, samet_fund_create_operation, samet_fund_delete_operation, samet_fund_update_operation, samet_fund_borrow_operation, samet_fund_repay_operation, credit_offer_create_operation, credit_offer_delete_operation, credit_offer_update_operation, credit_offer_accept_operation, credit_deal_repay_operation, credit_deal_expired_operation, liquidity_pool_update_operation, credit_deal_update_operation, limit_order_update_operation >
graphene::protocol::transaction
groups operations that should be applied atomically
Definition: transaction.hpp:69
graphene::chain::GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(limit_order_create)
graphene::chain::transaction_process_exception
block validation exception operation validation exception utility method exception transaction_process_exception
Definition: exceptions.cpp:62
GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION
#define GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION(exc_name, seqnum, msg)
Definition: internal_exceptions.hpp:35
FC_IMPLEMENT_EXCEPTION
#define FC_IMPLEMENT_EXCEPTION(TYPE, CODE, WHAT)
Definition: exception.hpp:281
graphene::chain::account_create
account_create
Definition: exceptions.cpp:104
graphene::chain::FC_IMPLEMENT_DERIVED_EXCEPTION
FC_IMPLEMENT_DERIVED_EXCEPTION(database_query_exception, chain_exception, 3010000, "database query exception") FC_IMPLEMENT_DERIVED_EXCEPTION(block_validate_exception
graphene::protocol::authority
Identifies a weighted set of keys and accounts that must approve operations.
Definition: authority.hpp:34
graphene::chain::chain_exception
chain_exception
Definition: exceptions.cpp:44
graphene::protocol::asset
Definition: asset.hpp:31
graphene::chain::limit_order_create
limit_order_create
Definition: exceptions.cpp:76
internal_exceptions.hpp
graphene
Definition: api.cpp:48
exceptions.hpp