Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / net / third_party / nss / ssl / sslerr.c
blob89f3c3b73cb034ed54b6c10f515a4206401322f7
1 /*
2 * Function to set error code only when meaningful error has not already
3 * been set.
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
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /* $Id: sslerr.c,v 1.5 2012/04/25 14:50:12 gerv%gerv.net Exp $ */
10 #include "prerror.h"
11 #include "secerr.h"
12 #include "sslerr.h"
13 #include "seccomon.h"
15 /* look at the current value of PR_GetError, and evaluate it to see
16 * if it is meaningful or meaningless (out of context).
17 * If it is meaningless, replace it with the hiLevelError.
18 * Returns the chosen error value.
20 int
21 ssl_MapLowLevelError(int hiLevelError)
23 int oldErr = PORT_GetError();
25 switch (oldErr) {
27 case 0:
28 case PR_IO_ERROR:
29 case SEC_ERROR_IO:
30 case SEC_ERROR_BAD_DATA:
31 case SEC_ERROR_LIBRARY_FAILURE:
32 case SEC_ERROR_EXTENSION_NOT_FOUND:
33 case SSL_ERROR_BAD_CLIENT:
34 case SSL_ERROR_BAD_SERVER:
35 case SSL_ERROR_SESSION_NOT_FOUND:
36 PORT_SetError(hiLevelError);
37 return hiLevelError;
39 default: /* leave the majority of error codes alone. */
40 return oldErr;