Refactor exception rescue