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

[5.0] Improve cleos error messages #1733

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions programs/cleos/help_text.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,10 @@ const char* error_advice_missing_auth_exception = R"=====(Ensure that you have
If you are currently using '@CLI_CLIENT_EXECUTABLE_NAME@ push action' command, try to add the relevant authority using -p option.)=====";
const char* error_advice_irrelevant_auth_exception = "Please remove the unnecessary authority from your action!";

const char* error_advice_missing_chain_api_plugin_exception = "Ensure that you have \033[2meosio::chain_api_plugin\033[0m\033[32m added to your node's configuration!";
const char* error_advice_missing_wallet_api_plugin_exception = "Ensure that you have \033[2meosio::wallet_api_plugin\033[0m\033[32m added to your node's configuration!\n"\
"Otherwise specify your wallet location with \033[2m--wallet-url\033[0m\033[32m argument!";
const char* error_advice_missing_history_api_plugin_exception = "Ensure that you have \033[2meosio::history_api_plugin\033[0m\033[32m added to your node's configuration!";
const char* error_advice_missing_net_api_plugin_exception = "Ensure that you have \033[2meosio::net_api_plugin\033[0m\033[32m added to your node's configuration!";
const char* error_advice_missing_chain_api_plugin_exception = "Ensure that you have \033[2meosio::chain_api_plugin\033[0m\033[32m added to your node's configuration and enabled on the specified endpoint.";
const char* error_advice_missing_wallet_api_plugin_exception = "Ensure that you have keosd enabled on the \033[2m--wallet-url\033[0m\033[32m specified endpoint.";
const char* error_advice_missing_history_api_plugin_exception = "Ensure that you have \033[2meosio::history_api_plugin\033[0m\033[32m added to your node's configuration and enabled on the specified endpoint.";
const char* error_advice_missing_net_api_plugin_exception = "Ensure that you have \033[2meosio::net_api_plugin\033[0m\033[32m added to your node's configuration and enabled on the specified endpoint.";

const char* error_advice_wallet_exist_exception = "Try to use different wallet name.";
const char* error_advice_wallet_nonexistent_exception = "Are you sure you typed the wallet name correctly?";
Expand Down
8 changes: 4 additions & 4 deletions programs/cleos/httpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ fc::variant do_http_call(const config_t& config, const std::string& base_uri, co
} else if( status_code == 404 ) {
// Unknown endpoint
if (path.compare(0, chain_func_base.size(), chain_func_base) == 0) {
throw chain::missing_chain_api_plugin_exception(FC_LOG_MESSAGE(error, "Chain API plugin is not enabled"));
throw chain::missing_chain_api_plugin_exception(FC_LOG_MESSAGE(error, "Chain API plugin is not enabled on specified endpoint"));
} else if (path.compare(0, wallet_func_base.size(), wallet_func_base) == 0) {
throw chain::missing_wallet_api_plugin_exception(FC_LOG_MESSAGE(error, "Wallet is not available"));
throw chain::missing_wallet_api_plugin_exception(FC_LOG_MESSAGE(error, "Wallet is not available on specified endpoint"));
} else if (path.compare(0, history_func_base.size(), history_func_base) == 0) {
throw chain::missing_history_api_plugin_exception(FC_LOG_MESSAGE(error, "History API plugin is not enabled"));
throw chain::missing_history_api_plugin_exception(FC_LOG_MESSAGE(error, "History API plugin is not enabled on specified endpoint"));
} else if (path.compare(0, net_func_base.size(), net_func_base) == 0) {
throw chain::missing_net_api_plugin_exception(FC_LOG_MESSAGE(error, "Net API plugin is not enabled"));
throw chain::missing_net_api_plugin_exception(FC_LOG_MESSAGE(error, "Net API plugin is not enabled on specified endpoint"));
}
} else {
auto &&error_info = response_result.as<eosio::error_results>().error;
Expand Down