Used a function with a side effect instead of throwing an exception to handle the side effect.