]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/TextException.cc
03592658f7a72f110bc2124530731571bc0c9d79
2 #include "TextException.h"
4 TextException::TextException()
11 TextException::TextException(const TextException
& right
) :
12 message((right
.message
?xstrdup(right
.message
):NULL
)), theFileName(right
.theFileName
), theLineNo(right
.theLineNo
)
16 TextException::TextException(const char *aMsg
, const char *aFileName
, int aLineNo
):
17 message(xstrdup(aMsg
)), theFileName(aFileName
), theLineNo(aLineNo
)
20 TextException::~TextException() throw()
22 if(message
) xfree(message
);
25 TextException
& TextException::operator=(const TextException
&right
)
27 if(this==&right
) return *this;
28 if(message
) xfree(message
);
29 message
=(right
.message
?xstrdup(right
.message
):NULL
);
30 theFileName
=right
.theFileName
;
31 theLineNo
=right
.theLineNo
;
36 const char *TextException::what() const throw()
38 /// \todo add file:lineno
39 return message
? message
: "TextException without a message";
42 void Throw(const char *message
, const char *fileName
, int lineNo
)
45 // or should we let the exception recepient print the exception instead?
48 debugs(0, 3, fileName
<< ':' << lineNo
<< ": exception" <<
49 (message
? ": " : ".") << (message
? message
: ""));
51 debugs(0, 3, "exception" <<
52 (message
? ": " : ".") << (message
? message
: ""));
55 throw TextException(message
, fileName
, lineNo
);