Hello,
I've installed Multichain and trying to make a Perl script to call JSON-RPC to a node, using JSON::RPC module.
$client = JSON::RPC::Client->new;
my $res = $client->call( $uri, $obj );
if ( $res ) {
if ($res->is_error) {
# case 1
$c->app->log->info( "Error : ". $res->error_message );
return;
}
else {
# case 2 - RPC success
return $res->result;
}
} else {
# case 3
$c->app->log->info( "Fail to receive response : ". $client->status_line );
return;
}
When I tried an invalid call, for example,
- sendasset more qty than I have ( debug.log output was "SendMoney() : Insufficient funds" )
- fill qty param with string("100"), not numeric(100) in the json object ( debug.log output was just "mcapi: API request failure" )
I expected the server node would send such error_message like "Insufficient funds"(case 1 in the code). However, my call() just returned undef(case 3) and $client->status_line was just "500 Internal Server Error". So I could not get any useful hint from the client's log and I have to look into debug.log in the server node every time.
Could my client get this detailed message from server's response, by setting multichain daemon parameters?
Thank you.