Yep makes sense, just make sure that you unlock before returning in the error case.