Detail.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 
21 {
22 public:
24 
25  ~ErrorDetail() override {}
26 
29  virtual SBuf brief() const = 0;
30 
33  virtual SBuf verbose(const HttpRequestPointer &) const = 0;
34 
35  // Duplicate details for the same error typically happen when we update some
36  // error storage (e.g., ALE) twice from the same detail source (e.g., the
37  // same HttpRequest object reachable via two different code/pointer paths)
38  // or retag the error with the same context information (e.g., WITH_CLIENT).
39  // In all those cases, comparing detail object addresses is enough to detect
40  // duplicates. In other cases (if they exist), a duplicate detail would
41  // imply inefficient or buggy error detailing code. Instead of spending ink
42  // and CPU cycles on hiding them, this comparison may expose those (minor)
43  // problems (in hope that they get fixed).
44  bool equals(const ErrorDetail &other) const { return this == &other; }
45 };
46 
50 
52 std::ostream &operator <<(std::ostream &os, const ErrorDetail &);
53 
54 // XXX: Every ErrorDetail child, especially those declaring their own Pointer
55 // types should overload this operator. The compiler will not find this overload
56 // for child pointers. See Security::ErrorDetail overload for an example.
58 std::ostream &operator <<(std::ostream &os, const ErrorDetail::Pointer &);
59 
60 #endif /* SQUID_SRC_ERROR_DETAIL_H */
61 
Definition: SBuf.h:93
ErrorDetail::Pointer MakeNamedErrorDetail(const char *name)
Definition: Detail.cc:54
std::ostream & operator<<(std::ostream &os, const ErrorDetail &)
dump the given ErrorDetail (for debugging)
Definition: Detail.cc:35
bool equals(const ErrorDetail &other) const
Definition: Detail.h:44
virtual SBuf brief() const =0
RefCount< ErrorDetail > ErrorDetailPointer
Definition: forward.h:93
~ErrorDetail() override
Definition: Detail.h:25
interface for supplying additional information about a transaction failure
Definition: Detail.h:20
virtual SBuf verbose(const HttpRequestPointer &) const =0

 

Introduction

Documentation

Support

Miscellaneous