Ignore:
Timestamp:
04/05/11 12:08:24 (14 years ago)
Author:
tbretz
Message:
The Converter functions now throw exceptions. The previous way of reporting a conversion error was not convenient.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/StateMachineImp.cc

    r10273 r10289  
    234234
    235235    const Converter conv(lout, fmt, false);
    236 
    237     const vector<char> v = conv.GetVector(str.substr(p0));
    238     if (!conv.valid() || v.empty()!=conv.empty())
    239     {
    240         lout << kRed << "Couldn't properly parse the input... ignored." << endl;
     236    if (!conv)
     237    {
     238        lout << kRed << "Couldn't properly parse the format... ignored." << endl;
    241239        return false;
    242240    }
    243241
    244     return PostEvent(*evt, v.data(), v.size());
    245 /*
    246     const Converter c(lout, fmt, str.substr(p0));
    247 
    248     // Parsing was not successfull
    249     if (!c.GetRc())
    250     {
    251         lout << kRed << "Couldn't properly parse the input... ignored." << endl;
    252         return false;
    253     }
    254 
    255     return PostEvent(*evt, c.Ptr(), c.Size());
    256     */
     242    try
     243    {
     244        const vector<char> v = conv.GetVector(str.substr(p0));
     245        return PostEvent(*evt, v.data(), v.size());
     246    }
     247    catch (const std::runtime_error &e)
     248    {
     249        lout << kRed << e.what() << endl;
     250    }
     251
     252    return false;
    257253}
    258254
Note: See TracChangeset for help on using the changeset viewer.