| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Function to set error code only when meaningful error has not already | 2 * Function to set error code only when meaningful error has not already |
| 3 * been set. | 3 * been set. |
| 4 * | 4 * |
| 5 * This Source Code Form is subject to the terms of the Mozilla Public | 5 * This Source Code Form is subject to the terms of the Mozilla Public |
| 6 * License, v. 2.0. If a copy of the MPL was not distributed with this | 6 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 8 | 8 |
| 9 #include "prerror.h" | 9 #include "prerror.h" |
| 10 #include "secerr.h" | 10 #include "secerr.h" |
| 11 #include "sslerr.h" | 11 #include "sslerr.h" |
| 12 #include "seccomon.h" | 12 #include "seccomon.h" |
| 13 | 13 |
| 14 /* look at the current value of PR_GetError, and evaluate it to see | 14 /* look at the current value of PR_GetError, and evaluate it to see |
| 15 * if it is meaningful or meaningless (out of context). | 15 * if it is meaningful or meaningless (out of context). |
| 16 * If it is meaningless, replace it with the hiLevelError. | 16 * If it is meaningless, replace it with the hiLevelError. |
| 17 * Returns the chosen error value. | 17 * Returns the chosen error value. |
| 18 */ | 18 */ |
| 19 int | 19 int |
| 20 ssl_MapLowLevelError(int hiLevelError) | 20 ssl_MapLowLevelError(int hiLevelError) |
| 21 { | 21 { |
| 22 int oldErr» = PORT_GetError(); | 22 int oldErr = PORT_GetError(); |
| 23 | 23 |
| 24 switch (oldErr) { | 24 switch (oldErr) { |
| 25 | 25 |
| 26 case 0: | 26 case 0: |
| 27 case PR_IO_ERROR: | 27 case PR_IO_ERROR: |
| 28 case SEC_ERROR_IO: | 28 case SEC_ERROR_IO: |
| 29 case SEC_ERROR_BAD_DATA: | 29 case SEC_ERROR_BAD_DATA: |
| 30 case SEC_ERROR_LIBRARY_FAILURE: | 30 case SEC_ERROR_LIBRARY_FAILURE: |
| 31 case SEC_ERROR_EXTENSION_NOT_FOUND: | 31 case SEC_ERROR_EXTENSION_NOT_FOUND: |
| 32 case SSL_ERROR_BAD_CLIENT: | 32 case SSL_ERROR_BAD_CLIENT: |
| 33 case SSL_ERROR_BAD_SERVER: | 33 case SSL_ERROR_BAD_SERVER: |
| 34 case SSL_ERROR_SESSION_NOT_FOUND: | 34 case SSL_ERROR_SESSION_NOT_FOUND: |
| 35 » PORT_SetError(hiLevelError); | 35 PORT_SetError(hiLevelError); |
| 36 » return hiLevelError; | 36 return hiLevelError; |
| 37 | 37 |
| 38 default:» /* leave the majority of error codes alone. */ | 38 default: /* leave the majority of error codes alone. */ |
| 39 » return oldErr; | 39 return oldErr; |
| 40 } | 40 } |
| 41 } | 41 } |
| OLD | NEW |