]>
Commit | Line | Data |
---|---|---|
83b053a0 | 1 | /* |
bf95c10a | 2 | * Copyright (C) 1996-2022 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_DETAIL_H | |
10 | #define _SQUID_SRC_ERROR_DETAIL_H | |
11 | ||
12 | #include "base/Here.h" | |
13 | #include "base/RefCount.h" | |
14 | #include "error/forward.h" | |
15 | #include "http/forward.h" | |
16 | #include "mem/forward.h" | |
17 | #include "sbuf/forward.h" | |
18 | ||
19 | /// interface for supplying additional information about a transaction failure | |
20 | class ErrorDetail: public RefCountable | |
21 | { | |
22 | public: | |
23 | using Pointer = ErrorDetailPointer; | |
24 | ||
337b9aa4 | 25 | ~ErrorDetail() override {} |
83b053a0 CT |
26 | |
27 | /// \returns a single "token" summarizing available details | |
28 | /// suitable as an access.log field and similar output processed by programs | |
29 | virtual SBuf brief() const = 0; | |
30 | ||
31 | /// \returns all available details; may be customized for the given request | |
32 | /// suitable for error pages and other output meant for human consumption | |
33 | virtual SBuf verbose(const HttpRequestPointer &) const = 0; | |
34 | }; | |
35 | ||
36 | /// creates a new NamedErrorDetail object with a unique name | |
37 | /// \see NamedErrorDetail::Name for naming restrictions | |
38 | ErrorDetail::Pointer MakeNamedErrorDetail(const char *name); | |
39 | ||
40 | /// dump the given ErrorDetail (for debugging) | |
41 | std::ostream &operator <<(std::ostream &os, const ErrorDetail &); | |
42 | ||
1f8dd0b2 AR |
43 | // XXX: Every ErrorDetail child, especially those declaring their own Pointer |
44 | // types should overload this operator. The compiler will not find this overload | |
45 | // for child pointers. See Security::ErrorDetail overload for an example. | |
46 | /// dump the given ErrorDetail via a possibly nil pointer (for debugging) | |
83b053a0 CT |
47 | std::ostream &operator <<(std::ostream &os, const ErrorDetail::Pointer &); |
48 | ||
49 | #endif /* _SQUID_SRC_ERROR_DETAIL_H */ | |
50 |