typeName << " status in:" << status());
}
-void AsyncJob::callException(const TextException &e)
+void AsyncJob::callException(const std::exception &e)
{
// we must be called asynchronously and hence, the caller must lock us
Must(cbdataReferenceValid(toCbdata()));
try {
doDial();
}
- catch (const TextException &e) {
+ catch (const std::exception &e) {
debugs(call.debugSection, 3,
- HERE << call.name << " threw exception: " << e.message);
+ HERE << call.name << " threw exception: " << e.what());
job->callException(e);
}
* asynchronous calls.
*/
-class TextException;
+class std::exception;
/// \ingroup AsyncJobAPI
class AsyncJob
// asynchronous call maintenance
bool canBeCalled(AsyncCall &call) const;
void callStart(AsyncCall &call);
- virtual void callException(const TextException &e);
+ virtual void callException(const std::exception &e);
virtual void callEnd();
protected:
parseBody();
}
-void ICAPModXact::callException(const TextException &e)
+void ICAPModXact::callException(const std::exception &e)
{
if (!canStartBypass || isRetriable) {
ICAPXaction::callException(e);
try {
debugs(93, 3, "bypassing ICAPModXact::" << inCall << " exception: " <<
- e.message << ' ' << status());
+ e.what() << ' ' << status());
bypassFailure();
}
- catch (const TextException &bypassE) {
+ catch (const std::exception &bypassE) {
ICAPXaction::callException(bypassE);
}
}
protected:
// bypasses exceptions if needed and possible
- virtual void callException(const TextException &e);
+ virtual void callException(const std::exception &e);
private:
virtual void start();
message(xstrdup(aMsg)), theFileName(aFileName), theLineNo(aLineNo)
{}
-TextException::~TextException()
+TextException::~TextException() throw()
{
xfree(message);
}
+const char *TextException::what() const throw()
+{
+ /// \todo add file:lineno
+ return message ? message : "TextException without a message";
+}
+
void Throw(const char *message, const char *fileName, int lineNo)
{
// simple exception to report custom errors
// we may want to change the interface to be able to report system errors
-class TextException
+class TextException: public std::exception
{
public:
TextException(const char *aMessage, const char *aFileName = 0, int aLineNo = -1);
- ~TextException();
+ virtual ~TextException() throw();
- // ostream &print(ostream &os) const;
+ virtual const char *what() const throw();
public:
char *message; // read-only
#define SQUID_EXIT_THROWING_CODE(status) \
status = true; \
} \
- catch (const TextException &e) { \
- debugs (11, 1, "Exception error:" << e.message); \
+ catch (const std::exception &e) { \
+ debugs (11, 1, "Exception error:" << e.what()); \
status = false; \
}