Replace exception used for flow control with idiomatic throw/catch.
Merge pull request #852 from avdi/avoid-exceptions-for-flow-control

Replace exceptions for flow control with idiomatic throw/catch