Changeset 10350


Ignore:
Timestamp:
Apr 10, 2011, 10:39:54 AM (9 years ago)
Author:
tbretz
Message:
Throw logic_error instead of runtime_error and throw in case the description contains a EOL character.
File:
1 edited

Legend:

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

    r10317 r10350  
    6262//!
    6363//! @throws
    64 //!     If a server name couldn't be reliably determined a runtime_error
    65 //!     exception is thrown.
     64//!     If a server name couldn't be reliably determined a logic_error
     65//!     exception is thrown; if the given description contains a '\n'
     66//!     also a logic_error is thrown.
    6667//
    6768DimDescriptionService::DimDescriptionService(const std::string &name, const std::string &desc)
     
    7273        const size_t p = name.find_first_of('/');
    7374        if (p==string::npos)
    74             throw runtime_error("Could not determine server name");
     75            throw logic_error("Could not determine server name");
    7576
    7677        service = name.substr(0, p);
    7778    }
     79
     80    if (desc.find_first_of('\n')!=string::npos)
     81            throw logic_error("Description for "+name+" contains '\\n'");
    7882
    7983    service += "/SERVICE_DESC";
Note: See TracChangeset for help on using the changeset viewer.