W
woodbrian77
I'm not sure if the following is due to a misunderstanding
on my part or a clang 3.2 problem. Notice the two catch
blocks below.
try{
// ...
}catch(eof const& ex){
syslog(LOG_ERR,"Got end of stream notice: %s",ex.what());
// ...
}catch:std::exception const& ex){
syslog(LOG_ERR,"Problem handling response %s",ex.what());
// ...
}
In a test I've caused my back tier to close it's connection
to the middle tier every 500th request. The code above is
from the middle tier. I have two definitions of the eof
class:
#if 0
class eof : public failure {
public:
explicit eof (char const* what_) : failure(what_)
{}
~eof () throw()
{}
};
#else
class eof : public ::std::exception {
::std::string whatStr;
public:
explicit eof (char const* what_) : whatStr(what_)
{}
~eof () throw()
{}
char const* what () const throw()
{ return whatStr.c_str(); }
template <class T>
eof& operator<< (T val)
{
::std:stringstream ss;
ss << val;
whatStr.append(ss.str().c_str());
return *this;
}
};
#endif
If I use the second, longer form, an eof exception is
caught as expected. But if I build the middle tier with
the shorter form of eof, the handler for std::exception
is the one used. This code and the definition of failure
is here --
http://webEbenezer.net/misc/ErrorWords.hh
I'd prefer to use the shorter form, but can't at this point.
Thanks in advance.
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
on my part or a clang 3.2 problem. Notice the two catch
blocks below.
try{
// ...
}catch(eof const& ex){
syslog(LOG_ERR,"Got end of stream notice: %s",ex.what());
// ...
}catch:std::exception const& ex){
syslog(LOG_ERR,"Problem handling response %s",ex.what());
// ...
}
In a test I've caused my back tier to close it's connection
to the middle tier every 500th request. The code above is
from the middle tier. I have two definitions of the eof
class:
#if 0
class eof : public failure {
public:
explicit eof (char const* what_) : failure(what_)
{}
~eof () throw()
{}
};
#else
class eof : public ::std::exception {
::std::string whatStr;
public:
explicit eof (char const* what_) : whatStr(what_)
{}
~eof () throw()
{}
char const* what () const throw()
{ return whatStr.c_str(); }
template <class T>
eof& operator<< (T val)
{
::std:stringstream ss;
ss << val;
whatStr.append(ss.str().c_str());
return *this;
}
};
#endif
If I use the second, longer form, an eof exception is
caught as expected. But if I build the middle tier with
the shorter form of eof, the handler for std::exception
is the one used. This code and the definition of failure
is here --
http://webEbenezer.net/misc/ErrorWords.hh
I'd prefer to use the shorter form, but can't at this point.
Thanks in advance.
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net