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:
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