Just check if splitting was possible. If there was no ':' character, the string is not splitted and the list contains only one element (the original string):
if (TextFields.count() == 1)
throw;
But in your case there is no need to use exceptions because you are detecting and handling the error inside your function. Instead you might use an error indicator and return that from your function:
int error = 0;
while (!error && !EndOfFile())
{
QString TextLine = ReadLine();
QStringList Textfields = TextLine.split(":");
if (TextFields.count() == 1)
{
error = 1;
}
else if (TextFields.count() > 1)
{
error = 2;
}
else
{
}
}
if (error)
{
}
return 0 == error;