Move assignment outside try block