]>
Commit | Line | Data |
---|---|---|
83b053a0 | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
83b053a0 CT |
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 | #ifndef _SQUID_SRC_ERROR_EXCEPTIONERRORDETAIL_H | |
10 | #define _SQUID_SRC_ERROR_EXCEPTIONERRORDETAIL_H | |
11 | ||
12 | #include "error/Detail.h" | |
13 | #include "sbuf/SBuf.h" | |
14 | #include "sbuf/Stream.h" | |
15 | ||
16 | /// offset for exception ID details, for backward compatibility | |
17 | #define SQUID_EXCEPTION_START_BASE 110000 | |
18 | ||
19 | /// Details a failure reported via a C++ exception. Stores exception ID which | |
20 | /// scripts/calc-must-ids.sh can map to a relevant source code location. | |
21 | class ExceptionErrorDetail: public ErrorDetail | |
22 | { | |
23 | MEMPROXY_CLASS(ExceptionErrorDetail); | |
24 | ||
25 | public: | |
26 | explicit ExceptionErrorDetail(const SourceLocationId id): exceptionId(SQUID_EXCEPTION_START_BASE + id) {} | |
27 | ||
28 | /* ErrorDetail API */ | |
337b9aa4 | 29 | SBuf brief() const override { |
83b053a0 CT |
30 | return ToSBuf("exception=", std::hex, exceptionId); |
31 | } | |
32 | ||
337b9aa4 | 33 | SBuf verbose(const HttpRequestPointer &) const override { |
83b053a0 CT |
34 | return ToSBuf("Exception (ID=", std::hex, exceptionId, ')'); |
35 | } | |
36 | ||
37 | private: | |
38 | SourceLocationId exceptionId; ///< identifies the thrower or catcher | |
f70aedc4 | 39 | }; |
83b053a0 CT |
40 | |
41 | #endif /* _SQUID_SRC_ERROR_EXCEPTIONERRORDETAIL_H */ | |
42 |