I rather like having different exit codes for different reasons.  Perhaps this should be an optional second parameter to the function.