OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/net_errors.h" | 5 #include "net/base/net_errors.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string> | 9 #include <string> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 Error MapSystemError(int os_error) { | 17 Error MapSystemError(logging::SystemErrorCode os_error) { |
18 if (os_error != 0) | 18 if (os_error != 0) |
19 DVLOG(2) << "Error " << os_error; | 19 DVLOG(2) << "Error " << os_error; |
20 | 20 |
21 // There are numerous posix error codes, but these are the ones we thus far | 21 // There are numerous posix error codes, but these are the ones we thus far |
22 // find interesting. | 22 // find interesting. |
23 switch (os_error) { | 23 switch (os_error) { |
24 case EAGAIN: | 24 case EAGAIN: |
25 #if EWOULDBLOCK != EAGAIN | 25 #if EWOULDBLOCK != EAGAIN |
26 case EWOULDBLOCK: | 26 case EWOULDBLOCK: |
27 #endif | 27 #endif |
(...skipping 85 matching lines...) Loading... |
113 case 0: | 113 case 0: |
114 return OK; | 114 return OK; |
115 default: | 115 default: |
116 LOG(WARNING) << "Unknown error " << os_error | 116 LOG(WARNING) << "Unknown error " << os_error |
117 << " mapped to net::ERR_FAILED"; | 117 << " mapped to net::ERR_FAILED"; |
118 return ERR_FAILED; | 118 return ERR_FAILED; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 } // namespace net | 122 } // namespace net |
OLD | NEW |