diff: reduce duplicate code Condense error checking to reduce a future diff moving those lines around; this pattern is already used in other parts of the tree. fine stsp ok tracey