]> git.ipfire.org Git - thirdparty/squid.git/blame - src/error/ExceptionErrorDetail.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / error / ExceptionErrorDetail.h
CommitLineData
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
ff9d9458
FC
9#ifndef SQUID_SRC_ERROR_EXCEPTIONERRORDETAIL_H
10#define SQUID_SRC_ERROR_EXCEPTIONERRORDETAIL_H
83b053a0 11
a4dd5bfa 12#include "base/IoManip.h"
83b053a0
CT
13#include "error/Detail.h"
14#include "sbuf/SBuf.h"
15#include "sbuf/Stream.h"
16
17/// offset for exception ID details, for backward compatibility
18#define SQUID_EXCEPTION_START_BASE 110000
19
20/// Details a failure reported via a C++ exception. Stores exception ID which
21/// scripts/calc-must-ids.sh can map to a relevant source code location.
22class ExceptionErrorDetail: public ErrorDetail
23{
24 MEMPROXY_CLASS(ExceptionErrorDetail);
25
26public:
27 explicit ExceptionErrorDetail(const SourceLocationId id): exceptionId(SQUID_EXCEPTION_START_BASE + id) {}
28
29 /* ErrorDetail API */
337b9aa4 30 SBuf brief() const override {
a4dd5bfa 31 return ToSBuf("exception=", asHex(exceptionId));
83b053a0
CT
32 }
33
337b9aa4 34 SBuf verbose(const HttpRequestPointer &) const override {
a4dd5bfa 35 return ToSBuf("Exception (ID=", asHex(exceptionId), ')');
83b053a0
CT
36 }
37
38private:
39 SourceLocationId exceptionId; ///< identifies the thrower or catcher
f70aedc4 40};
83b053a0 41
ff9d9458 42#endif /* SQUID_SRC_ERROR_EXCEPTIONERRORDETAIL_H */
83b053a0 43