factor all the error paths back together