]> git.ipfire.org Git - thirdparty/squid.git/blame - src/TextException.h
Updated FwdState::updateHierarchyInfo() documentation with Henrik's comment
[thirdparty/squid.git] / src / TextException.h
CommitLineData
774c051c 1#ifndef SQUID__TEXTEXCEPTION_H
2#define SQUID__TEXTEXCEPTION_H
3
4// Origin: xstd/TextException
5
6
7// simple exception to report custom errors
8// we may want to change the interface to be able to report system errors
9
0a8bbeeb 10class TextException: public std::exception
774c051c 11{
12
13public:
14 TextException(const char *aMessage, const char *aFileName = 0, int aLineNo = -1);
0a8bbeeb 15 virtual ~TextException() throw();
774c051c 16
0a8bbeeb 17 virtual const char *what() const throw();
774c051c 18
19public:
20 char *message; // read-only
21
22protected:
23 // optional location information
24 const char *theFileName;
25 int theLineNo;
26};
27
28//inline
29//ostream &operator <<(ostream &os, const TextException &exx) {
c99de607 30// return exx.print(os);
774c051c 31//}
32
33#if !defined(TexcHere)
c99de607 34# define TexcHere(msg) TextException((msg), __FILE__, __LINE__)
774c051c 35#endif
36
37extern void Throw(const char *message, const char *fileName, int lineNo);
38
39// Must(condition) is like assert(condition) but throws an exception instead
40#if !defined(Must)
c99de607 41# define Must(cond) ((cond) ? \
42 (void)0 : \
43 (void)Throw(#cond, __FILE__, __LINE__))
774c051c 44#endif
45
46#endif /* SQUID__TEXTEXCEPTION_H */