adding check for input corruption when raising TextParsingExceptions