distance helper error catcher