pull error handling logic into separate subroutine