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{
22public:
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
52std::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.
58std::ostream &operator <<(std::ostream &os, const ErrorDetail::Pointer &);
59
60#endif /* _SQUID_SRC_ERROR_DETAIL_H */
61
std::ostream & operator<<(std::ostream &os, const ErrorDetail &)
dump the given ErrorDetail (for debugging)
Definition: Detail.cc:35
ErrorDetail::Pointer MakeNamedErrorDetail(const char *name)
Definition: Detail.cc:54
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
interface for supplying additional information about a transaction failure
Definition: Detail.h:21
~ErrorDetail() override
Definition: Detail.h:25
virtual SBuf verbose(const HttpRequestPointer &) const =0
virtual SBuf brief() const =0
bool equals(const ErrorDetail &other) const
Definition: Detail.h:44
Definition: SBuf.h:94
RefCount< ErrorDetail > ErrorDetailPointer
Definition: forward.h:95

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors