SysErrorDetail.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
20public:
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 virtual SBuf brief() const override;
33 virtual SBuf verbose(const HttpRequestPointer &) const override;
34
35private:
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{
45public:
46 explicit ReportSysError(const int anErrorNo): errorNo(anErrorNo) {}
48};
49
51std::ostream &operator <<(std::ostream &, ReportSysError);
52
53#endif /* _SQUID_SRC_ERROR_SYSERRORDETAIL_H */
54
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:21
a stream manipulator for printing a system call error (if any)
ReportSysError(const int anErrorNo)
Definition: SBuf.h:94
system call failure detail based on standard errno(3)/strerror(3) APIs
static ErrorDetail::Pointer NewIfAny(const int errorNo)
virtual SBuf brief() const override
static SBuf Brief(int errorNo)
MEMPROXY_CLASS(SysErrorDetail)
SysErrorDetail(const int anErrorNo)
virtual SBuf verbose(const HttpRequestPointer &) const override
int errorNo
errno(3) set by the last failed system call or equivalent

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors