Replace exceptions for flow control with idiomatic throw/catch