TextException.h File Reference
#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)
 
#define Must(condition)   Must3((condition), #condition, Here())
 Like assert() but throws an exception instead of aborting the process. More...
 
#define SWALLOW_EXCEPTIONS(code)
 

Functions

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

Macro Definition Documentation

◆ Must

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

Definition at line 73 of file TextException.h.

◆ Must3

#define Must3 (   condition,
  description,
  location 
)
Value:
do { \
if (!(condition)) { \
const TextException Must_ex_(("check failed: " description), (location)); \
debugs(0, 3, Must_ex_.what()); \
throw Must_ex_; \
} \
} while (/*CONSTCOND*/ false)

Like assert() but throws an exception instead of aborting the process and allows the caller to customize the exception message and location.

Parameters
descriptionstring literal describing the condition; what MUST happen

Definition at line 63 of file TextException.h.

◆ SWALLOW_EXCEPTIONS

#define SWALLOW_EXCEPTIONS (   code)
Value:
try { \
code \
} catch (...) { \
debugs(0, DBG_IMPORTANT, "BUG: ignoring exception;" << \
Debug::Extra << "bug location: " << Here() << \
Debug::Extra << "ignored exception: " << CurrentException); \
}

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 77 of file TextException.h.

◆ TexcHere

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

Definition at line 58 of file TextException.h.

Function Documentation

◆ CurrentException()

◆ operator<<()

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

Definition at line 61 of file TextException.cc.

References TextException::print().

#define Here()
source code location of the caller
Definition: Here.h:15
static std::ostream & Extra(std::ostream &os)
prefixes each grouped debugs() line after the first one in the group
Definition: Debug.h:99
#define DBG_IMPORTANT
Definition: Debug.h:41
std::ostream & CurrentException(std::ostream &)
prints active (i.e., thrown but not yet handled) exception
an std::runtime_error with thrower location info
Definition: TextException.h:20

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors