Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add funcation post_dispatch the complier will throw 0000245: error: OnElseExpr callback failed #264

Open
craone opened this issue Dec 24, 2023 · 2 comments

Comments

@craone
Copy link

craone commented Dec 24, 2023

This is simple contract code

#include <eosio/eosio.hpp>
using namespace eosio;

CONTRACT mycontract : public contract {
   public:
      using contract::contract;
      // Every ACTION you define can be called from outside the blockchain
      ACTION newuser( name eos_account ){
      }
};

extern "C" bool post_dispatch(
    eosio::name receiver,
    eosio::name code,
    eosio::name action
){
	print_f("post_dispatch : % % %\n", receiver, code, action);
	return true;
};

It will throw an error

Error: error: else expression without matching if
0000245: error: OnElseExpr callback failed
eosio-pp failed
 
Build failed! 
Building project "Untitled Project"... 

but pre_dispatch method is complie success.

@spoonincode
Copy link
Member

I believe you must use both pre_dispatch() and post_dispatch() if you use one of them. However, the pre/post_dispatch() functions are very esoteric and I would recommend avoiding them.

@craone
Copy link
Author

craone commented Feb 24, 2024

The error (0000245) still occurs when using both both pre_dispatch() and post_dispatch(). To avoid this issue, we will refrain from using them. So we won't fix this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants