zeroc-ice / ice-demos

Sample programs for Ice
https://zeroc.com
GNU General Public License v2.0
323 stars 217 forks source link

Handle exceptions from stoi calls #179

Closed pepone closed 1 year ago

pepone commented 1 year ago

This PR fixes IceGrid/replication and IceDiscovery/replication to correctly handle errors from stoi. It also updates the loop that reads the input parameters to make clear how to exit.

externl commented 1 year ago

It also updates the loop that reads the input parameters to make clear how to exit.

Having 3 while loops seems like a lot. Maybe we should just get rid of all these loops?

pepone commented 1 year ago

Having 3 while loops seems like a lot. Maybe we should just get rid of all these loops?

What about exiting and printing an error if stoi fails with invalid_argument and keeping just the main loop?