exception handling in tokenizer class