return error instead of panic when Begin transaction