Catch exception when looking up hostname