I think this should be `try`/`except` instead of `if`/`else`.