Skip to content

Commit 2e35fef

Browse files
authored
Improved sample program in README
1 parent 74f9152 commit 2e35fef

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ int main()
4747
std::string address = "127.0.0.1";
4848
int port = 8332;
4949
50-
/* Constructor to connect to the bitcoin daemon */
51-
BitcoinAPI btc(username, password, address, port);
52-
53-
/* Example method - getbalance */
54-
std::cout << "Wallet balance: " << btc.getbalance() << std::endl;
50+
try
51+
{
52+
/* Constructor to connect to the bitcoin daemon */
53+
BitcoinAPI btc(username, password, address, port);
54+
55+
/* Example method - getbalance */
56+
std::cout << "Wallet balance: " << btc.getbalance() << std::endl;
57+
}catch(BitcoinException e)
58+
{
59+
std::cerr << e.getMessage() << std::endl;
60+
}
5561
}
5662
```
5763

0 commit comments

Comments
 (0)