Go to the source code of this file.
|
| #define | Assure_(debugLevel, condition, description, location) |
| |
| #define | Assure(condition) Assure2((condition), #condition) |
| |
| #define | Assure2(condition, description) Assure_(0, (condition), ("assurance failed: " description), Here()) |
| |
◆ Assure
| #define Assure |
( |
|
condition | ) |
Assure2((condition), #condition) |
Like assert() but throws an exception instead of aborting the process. Use this macro to detect code logic mistakes (i.e. bugs) where aborting the current AsyncJob or a similar task is unlikely to jeopardize Squid service integrity. For example, this macro is not appropriate for detecting bugs that indicate a dangerous global state corruption which may go unnoticed by other jobs after the current job or task is aborted.
Definition at line 35 of file Assure.h.
◆ Assure2
| #define Assure2 |
( |
|
condition, |
|
|
|
description |
|
) |
| Assure_(0, (condition), ("assurance failed: " description), Here()) |
Like Assure() but allows the caller to customize the exception message.
- Parameters
-
| description | string literal describing the condition (i.e. what MUST happen) |
Definition at line 40 of file Assure.h.
◆ Assure_
| #define Assure_ |
( |
|
debugLevel, |
|
|
|
condition, |
|
|
|
description, |
|
|
|
location |
|
) |
| |
Value: while (!(condition)) \
ReportAndThrow_((debugLevel), (description), (location))
Calls ReportAndThrow() if needed. Reduces caller code duplication. Do not call directly; use Assure() instead.
- Parameters
-
| description | c-string explaining the condition (i.e. what MUST happen) |
Definition at line 23 of file Assure.h.
◆ ReportAndThrow_()
| void ReportAndThrow_ |
( |
int |
debugLevel, |
|
|
const char * |
description, |
|
|
const SourceLocation & |
location |
|
) |
| |
Reports the description (at the given debugging level) and throws the corresponding exception. Reduces compiled code size of Assure() and Must() callers. Do not call directly; use Assure() instead.
- Parameters
-
| description | explains the condition (i.e. what MUST happen) |
Definition at line 15 of file Assure.cc.
References DBG_IMPORTANT, and debugs.