Handling errors as return values
- Each function that fails returns some error indicator. None ? An object that has and attribute "error"?
- None would be bad as that cannot indicate different errors.
- Every called needs to check if the function returned error. If at any point we forget our system might run with hidden failures.
main() ...... result = do_something(filename) if result: do_something_else(result)
main() ...... result = do_something(filename) do_something_else(result)