Nit: always combine declaration with assignment when you can. In this case, just move this into the `try` block