Handle exception when trying to getLine