]> git.ipfire.org Git - thirdparty/squid.git/blob - src/base/Assure.cc
d9c5ef1faad8d1ba50b48a6a5d3bf3f937bbe741
[thirdparty/squid.git] / src / base / Assure.cc
1 /*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "base/Assure.h"
11 #include "base/TextException.h"
12 #include "debug/Stream.h"
13
14 [[ noreturn ]] void
15 ReportAndThrow_(const int debugLevel, const char *description, const SourceLocation &location)
16 {
17 const TextException ex(description, location);
18 const auto label = debugLevel <= DBG_IMPORTANT ? "ERROR: Squid BUG: " : "";
19 // TODO: Consider also printing the number of BUGs reported so far. It would
20 // require GC, but we could even print the number of same-location reports.
21 debugs(0, debugLevel, label << ex);
22 throw ex;
23 }
24