Is there a standard way to resolve this? `try-except` that returns from the function with a negative status?