catch the unexpected end of input exception