]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/base/TextException.cc
2 #include "base/TextException.h"
6 TextException::TextException()
13 TextException::TextException(const TextException
& right
) :
14 message((right
.message
?xstrdup(right
.message
):NULL
)), theFileName(right
.theFileName
), theLineNo(right
.theLineNo
)
18 TextException::TextException(const char *aMsg
, const char *aFileName
, int aLineNo
):
19 message(xstrdup(aMsg
)), theFileName(aFileName
), theLineNo(aLineNo
)
22 TextException::~TextException() throw()
24 if (message
) xfree(message
);
27 TextException
& TextException::operator=(const TextException
&right
)
29 if (this==&right
) return *this;
30 if (message
) xfree(message
);
31 message
=(right
.message
?xstrdup(right
.message
):NULL
);
32 theFileName
=right
.theFileName
;
33 theLineNo
=right
.theLineNo
;
38 const char *TextException::what() const throw()
40 /// \todo add file:lineno
41 return message
? message
: "TextException without a message";
44 void Throw(const char *message
, const char *fileName
, int lineNo
)
47 // or should we let the exception recepient print the exception instead?
50 debugs(0, 3, fileName
<< ':' << lineNo
<< ": exception" <<
51 (message
? ": " : ".") << (message
? message
: ""));
53 debugs(0, 3, "exception" <<
54 (message
? ": " : ".") << (message
? message
: ""));
57 throw TextException(message
, fileName
, lineNo
);