TextException.h File Reference
#include "base/Assure.h"
#include "base/Here.h"
#include <stdexcept>
Include dependency graph for TextException.h:

Go to the source code of this file.

Classes

class  TextException
 an std::runtime_error with thrower location info More...
 

Macros

#define TexcHere(msg)   TextException((msg), Here())
 legacy convenience macro; it is not difficult to type Here() now More...
 
#define Must3(condition, description, location)    Assure_(3, (condition), ("check failed: " description), (location))
 
#define Must(condition)   Must3((condition), #condition, Here())
 
#define SWALLOW_EXCEPTIONS(code)
 

Functions

std::ostream & CurrentException (std::ostream &)
 prints active (i.e., thrown but not yet handled) exception More...
 
std::ostream & CurrentExceptionExtra (std::ostream &)
 
std::ostream & operator<< (std::ostream &, const TextException &)
 efficiently prints TextException More...
 

Macro Definition Documentation

◆ Must

#define Must (   condition)    Must3((condition), #condition, Here())

Like Assure() but only logs the exception if level-3 debugging is enabled and runs even when NDEBUG macro is defined. Deprecated: Use Assure() for code logic checks and throw explicitly when input validation fails.

Definition at line 75 of file TextException.h.

◆ Must3

#define Must3 (   condition,
  description,
  location 
)     Assure_(3, (condition), ("check failed: " description), (location))

Like Must() but supports custom exception message and location.

Parameters
descriptionstring literal describing the condition; what MUST happen Deprecated: Use Assure2() for code logic checks and throw explicitly when input validation fails.

Definition at line 69 of file TextException.h.

◆ SWALLOW_EXCEPTIONS

#define SWALLOW_EXCEPTIONS (   code)
Value:
try { \
code \
} catch (...) { \
debugs(0, DBG_IMPORTANT, "ERROR: Squid BUG: ignoring exception;" << \
Debug::Extra << "bug location: " << Here() << \
Debug::Extra << "ignored exception: " << CurrentException); \
}
#define Here()
source code location of the caller
Definition: Here.h:15
std::ostream & CurrentException(std::ostream &)
prints active (i.e., thrown but not yet handled) exception
static std::ostream & Extra(std::ostream &)
Definition: debug.cc:1313
#define DBG_IMPORTANT
Definition: Stream.h:38

Reports and swallows all exceptions to prevent compiler warnings and runtime errors related to throwing class destructors. Should be used for most dtors.

Definition at line 79 of file TextException.h.

◆ TexcHere

#define TexcHere (   msg)    TextException((msg), Here())

Definition at line 63 of file TextException.h.

Function Documentation

◆ CurrentException()

◆ CurrentExceptionExtra()

std::ostream & CurrentExceptionExtra ( std::ostream &  os)

If there is an active (i.e., thrown but not yet handled) exception, reports it on a dedicated DebugExtra line. Otherwise, does nothing.

Definition at line 99 of file TextException.cc.

References CurrentException_(), and Debug::Extra().

Referenced by OnTerminate().

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const TextException ex 
)

Definition at line 61 of file TextException.cc.

References TextException::print().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors