Error.cc
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/* DEBUG: section 04 Error Management */
10
11#include "squid.h"
12#include "debug/Stream.h"
13#include "error/Error.h"
14
15void
16Error::update(const Error &recent)
17{
18 if (*this)
19 debugs(4, 5, "old: " << *this);
20 if (!recent)
21 return; // no changes
22 debugs(4, 3, "recent: " << recent);
23 // checking category and detail separately may cause inconsistency, but
24 // may result in more details available if they only become available later
25 if (category == ERR_NONE)
26 category = recent.category; // may still be ERR_NONE
27 if (!detail)
28 detail = recent.detail; // may still be nil
29}
30
31std::ostream &
32operator <<(std::ostream &os, const Error &error)
33{
34 os << errorTypeName(error.category);
35 if (error.detail)
36 os << '/' << *error.detail;
37 return os;
38}
39
std::ostream & operator<<(std::ostream &os, const Error &error)
Definition: Error.cc:32
const char * errorTypeName(err_type err)
Definition: Error.h:53
void error(char *format,...)
a transaction problem
Definition: Error.h:18
err_type category
primary error classification (or ERR_NONE)
Definition: Error.h:35
void update(const Error &)
if necessary, stores the given error information (if any)
Definition: Error.cc:16
ErrorDetailPointer detail
additional details about the error
Definition: Error.h:36
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
@ ERR_NONE
Definition: forward.h:15

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors