1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_BASE_NET_ERRORS_H__ 6 #define NET_BASE_NET_ERRORS_H__ 7 8 #include "base/basictypes.h" 9 10 namespace net { 11 12 // Error domain of the net module's error codes. 13 extern const char kErrorDomain[]; 14 15 // Error values are negative. 16 enum Error { 17 // No error. 18 OK = 0, 19 20 #define NET_ERROR(label, value) ERR_ ## label = value, 21 #include "net/base/net_error_list.h" 22 #undef NET_ERROR 23 24 // The value of the first certificate error code. 25 ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID, 26 }; 27 28 // Returns a textual representation of the error code for logging purposes. 29 const char* ErrorToString(int error); 30 31 // Returns true if |error| is a certificate error code. 32 inline bool IsCertificateError(int error) { 33 // Certificate errors are negative integers from net::ERR_CERT_BEGIN 34 // (inclusive) to net::ERR_CERT_END (exclusive) in *decreasing* order. 35 return error <= ERR_CERT_BEGIN && error > ERR_CERT_END; 36 } 37 38 } // namespace net 39 40 #endif // NET_BASE_NET_ERRORS_H__ 41