SysErrorDetail.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_SYSERRORDETAIL_H
10 #define SQUID_SRC_ERROR_SYSERRORDETAIL_H
11 
12 #include "error/Detail.h"
13 #include "sbuf/forward.h"
14 
17 {
19 
20 public:
23  {
24  // we could optimize by caching results for (frequently used?) errnos
25  return errorNo ? new SysErrorDetail(errorNo) : nullptr;
26  }
27 
29  static SBuf Brief(int errorNo);
30 
31  /* ErrorDetail API */
32  SBuf brief() const override;
33  SBuf verbose(const HttpRequestPointer &) const override;
34 
35 private:
36  // hidden by NewIfAny() to avoid creating SysErrorDetail from zero errno
37  explicit SysErrorDetail(const int anErrorNo): errorNo(anErrorNo) {}
38 
39  int errorNo;
40 };
41 
44 {
45 public:
46  explicit ReportSysError(const int anErrorNo): errorNo(anErrorNo) {}
47  int errorNo;
48 };
49 
51 std::ostream &operator <<(std::ostream &, ReportSysError);
52 
53 #endif /* SQUID_SRC_ERROR_SYSERRORDETAIL_H */
54 
int errorNo
errno(3) set by the last failed system call or equivalent
SBuf brief() const override
SBuf verbose(const HttpRequestPointer &) const override
system call failure detail based on standard errno(3)/strerror(3) APIs
Definition: SBuf.h:93
a stream manipulator for printing a system call error (if any)
SysErrorDetail(const int anErrorNo)
ReportSysError(const int anErrorNo)
static ErrorDetail::Pointer NewIfAny(const int errorNo)
MEMPROXY_CLASS(SysErrorDetail)
static SBuf Brief(int errorNo)
std::ostream & operator<<(std::ostream &, ReportSysError)
reports a system call error (if any) on a dedicated Debug::Extra line
interface for supplying additional information about a transaction failure
Definition: Detail.h:20

 

Introduction

Documentation

Support

Miscellaneous