Refactor: avoid try/except block.