perf: refactor location of try block