]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 1996-2021 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 | #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 | ||
25 | virtual ~ErrorDetail() {} | |
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 | ||
43 | /// dump the given ErrorDetail pointer which may be nil (for debugging) | |
44 | std::ostream &operator <<(std::ostream &os, const ErrorDetail::Pointer &); | |
45 | ||
46 | #endif /* _SQUID_SRC_ERROR_DETAIL_H */ | |
47 |