Assign return value to a variable and return it at the end rather than
trying to return from within a try block