- renamed "description()" member to "errorString()",
- renamed "where" attribute to "description",
- changed "what()" ouptut.
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@732
270642c3-0616-0410-b53a-bc976706d245
::unlink(una.path().c_str());
}
catch (SystemException & e) {
- SENF_LOG(("UNSocketProtocol::check_and_unlink() failed; " << e.description() ));
+ SENF_LOG(("UNSocketProtocol::check_and_unlink() failed; " << e.errorString() ));
}
}
if (! pidfile_.empty()) {
try {
LIBC_CALL( ::unlink, (pidfile_.c_str()) );
- } catch (SystemException e) {
- e << "; could not unlink " << pidfile_.c_str();
+ } catch (Exception e) {
+ // e << "; could not unlink " << pidfile_.c_str();
// throw;
}
}
// was some race condition, probably over NFS.
std::string tempname;
- boost::format linkErrorFormat(" Could not link \"%1%\" to \"%2%\".");
+ boost::format linkErrorFormat("; could not link \"%1%\" to \"%2%\".");
{
char hostname[HOST_NAME_MAX+1];
///////////////////////////////////////////////////////////////////////////
// senf::SystemException
-prefix_ void senf::SystemException::init(std::string const & where, int code)
+prefix_ void senf::SystemException::init(std::string const & descr, int code)
{
code_ = code;
- if (! where.empty())
- (*this) << where << ": ";
- (*this) << "(" << code << ") " << description();
+ (*this) << "[" << errorString() << "]";
+ if (! descr.empty()) (*this) << "; " << descr;
}
///////////////////////////////cc.e////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
-prefix_ senf::SystemException::SystemException(std::string const & where)
+prefix_ senf::SystemException::SystemException(std::string const & descr)
{
- init(where, errno);
+ init(descr, errno);
}
prefix_ senf::SystemException::SystemException(int code)
init("", code);
}
-prefix_ senf::SystemException::SystemException(std::string const & where, int code)
+prefix_ senf::SystemException::SystemException(std::string const & descr, int code)
{
- init(where, code);
+ init(descr, code);
}
prefix_ int senf::SystemException::errorNumber()
return code_;
}
-prefix_ char const * senf::SystemException::description()
+prefix_ char const * senf::SystemException::errorString()
const
{
return std::strerror(code_);
///\name Structors and default members
///@{
- explicit SystemException(std::string const & where = "");
+ explicit SystemException(std::string const & descr = "");
explicit SystemException(int code);
- SystemException(std::string const & where, int code);
+ SystemException(std::string const & descr, int code);
virtual ~SystemException() throw();
///////////////////////////////////////////////////////////////////////////
int errorNumber() const; ///< Error code (\c errno number)
- char const * description() const; ///< Error description (\c strerror() value)
+ char const * errorString() const; ///< Error string (\c strerror() value)
bool anyOf(int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0,
int c6=0, int c7=0, int c8=0, int c9=0);
private:
- void init(std::string const & where, int code);
+ void init(std::string const & descr, int code);
int code_;
+ std::string what_;
};
}
}
catch (senf::SystemException & e) {
BOOST_CHECK_EQUAL( e.errorNumber(), ENOENT );
- BOOST_CHECK_EQUAL( e.what(), "::open(): (2) No such file or directory\nx=1\ny=2" );
+ //BOOST_CHECK_EQUAL( e.what(), "::open(): (2) No such file or directory\nx=1\ny=2" );
+ BOOST_CHECK_EQUAL( e.what(), "[No such file or directory]; ::open()\nx=1\ny=2" );
}
}