Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/third_party/closure/goog/net/errorcode.js
2868 views
1
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS-IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/**
16
* @fileoverview Error codes shared between goog.net.IframeIo and
17
* goog.net.XhrIo.
18
*/
19
20
goog.provide('goog.net.ErrorCode');
21
22
23
/**
24
* Error codes
25
* @enum {number}
26
*/
27
goog.net.ErrorCode = {
28
29
/**
30
* There is no error condition.
31
*/
32
NO_ERROR: 0,
33
34
/**
35
* The most common error from iframeio, unfortunately, is that the browser
36
* responded with an error page that is classed as a different domain. The
37
* situations, are when a browser error page is shown -- 404, access denied,
38
* DNS failure, connection reset etc.)
39
*
40
*/
41
ACCESS_DENIED: 1,
42
43
/**
44
* Currently the only case where file not found will be caused is when the
45
* code is running on the local file system and a non-IE browser makes a
46
* request to a file that doesn't exist.
47
*/
48
FILE_NOT_FOUND: 2,
49
50
/**
51
* If Firefox shows a browser error page, such as a connection reset by
52
* server or access denied, then it will fail silently without the error or
53
* load handlers firing.
54
*/
55
FF_SILENT_ERROR: 3,
56
57
/**
58
* Custom error provided by the client through the error check hook.
59
*/
60
CUSTOM_ERROR: 4,
61
62
/**
63
* Exception was thrown while processing the request.
64
*/
65
EXCEPTION: 5,
66
67
/**
68
* The Http response returned a non-successful http status code.
69
*/
70
HTTP_ERROR: 6,
71
72
/**
73
* The request was aborted.
74
*/
75
ABORT: 7,
76
77
/**
78
* The request timed out.
79
*/
80
TIMEOUT: 8,
81
82
/**
83
* The resource is not available offline.
84
*/
85
OFFLINE: 9
86
};
87
88
89
/**
90
* Returns a friendly error message for an error code. These messages are for
91
* debugging and are not localized.
92
* @param {goog.net.ErrorCode} errorCode An error code.
93
* @return {string} A message for debugging.
94
*/
95
goog.net.ErrorCode.getDebugMessage = function(errorCode) {
96
switch (errorCode) {
97
case goog.net.ErrorCode.NO_ERROR:
98
return 'No Error';
99
100
case goog.net.ErrorCode.ACCESS_DENIED:
101
return 'Access denied to content document';
102
103
case goog.net.ErrorCode.FILE_NOT_FOUND:
104
return 'File not found';
105
106
case goog.net.ErrorCode.FF_SILENT_ERROR:
107
return 'Firefox silently errored';
108
109
case goog.net.ErrorCode.CUSTOM_ERROR:
110
return 'Application custom error';
111
112
case goog.net.ErrorCode.EXCEPTION:
113
return 'An exception occurred';
114
115
case goog.net.ErrorCode.HTTP_ERROR:
116
return 'Http response at 400 or 500 level';
117
118
case goog.net.ErrorCode.ABORT:
119
return 'Request was aborted';
120
121
case goog.net.ErrorCode.TIMEOUT:
122
return 'Request timed out';
123
124
case goog.net.ErrorCode.OFFLINE:
125
return 'The resource is not available offline';
126
127
default:
128
return 'Unrecognized error code';
129
}
130
};
131
132