Chromium Code Reviews| Index: net/base/net_errors.cc |
| diff --git a/net/base/net_errors.cc b/net/base/net_errors.cc |
| index a9d1443c913003615f2d4742deb06ecc6bf8d512..59c3d1f299732475bf32d05c3700c7c72be2f165 100644 |
| --- a/net/base/net_errors.cc |
| +++ b/net/base/net_errors.cc |
| @@ -24,19 +24,35 @@ namespace net { |
| const char kErrorDomain[] = "net"; |
| -const char* ErrorToString(int error) { |
| +std::string ErrorToShortString(int error) { |
| if (error == 0) |
| - return "net::OK"; |
| + return "OK"; |
| + const char* error_string; |
| switch (error) { |
| #define NET_ERROR(label, value) \ |
| case ERR_ ## label: \ |
| - return "net::" STRINGIZE_NO_EXPANSION(ERR_ ## label); |
| + error_string = # label; \ |
| + break; |
| #include "net/base/net_error_list.h" |
| #undef NET_ERROR |
| default: |
| - return "net::<unknown>"; |
| + return "<unknown>"; |
|
eroman
2014/08/05 22:54:51
Should this be prefixed with ERR_ too?
mmenke
2014/08/06 16:40:56
Done. I did that initially, but it looks kinda we
|
| } |
| + return std::string("ERR_").append(error_string); |
|
eroman
2014/08/05 22:54:50
nit: below you use operator+ to concatenate string
mmenke
2014/08/06 16:40:56
Done.
|
| +} |
| + |
| +std::string ErrorToString(int error) { |
| + return "net::" + ErrorToShortString(error); |
| +} |
| + |
| +bool IsCertificateError(int error) { |
| + // Certificate errors are negative integers from net::ERR_CERT_BEGIN |
| + // (inclusive) to net::ERR_CERT_END (exclusive) in *decreasing* order. |
| + // ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN is currently an exception to this |
| + // rule. |
| + return (error <= ERR_CERT_BEGIN && error > ERR_CERT_END) || |
|
eroman
2014/08/05 22:54:50
I presume this is unchanged, did not review.
mmenke
2014/08/06 16:40:56
Correct. I just moved it, since it was incorrectl
|
| + (error == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN); |
| } |
| std::vector<int> GetAllErrorCodesForUma() { |