refactor: move err check closer to assignment
Created by: rvantonder
Minor thing, this error check should be closer to its assignment.
Stacked on #8687.
Created by: rvantonder
Minor thing, this error check should be closer to its assignment.
Stacked on #8687.