I think it would make sense to put all this before the `try/catch` block and not throw so that the warning doesn't get logged twice?