File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 18
18
"hash" : tableau . dataTypeEnum . string ,
19
19
"code_size" : tableau . dataTypeEnum . int } ;
20
20
21
+ /** Get a json payload from the LNT server asynchronously or error.
22
+ * @param {string } payload_url JSON payloads URL.
23
+ */
21
24
function getValue ( payload_url ) {
22
- var value = $ . ajax ( {
25
+ var response = $ . ajax ( {
23
26
url : payload_url ,
24
- async : false
25
- } ) . responseText ;
26
- return JSON . parse ( value ) ;
27
+ async : false ,
28
+ cache : false ,
29
+ timeout : 60000 , // Make all requests timeout after a minute.
30
+ } ) ;
31
+
32
+ if ( response . status >= 400 ) {
33
+ var error_msg = "Requesting data from LNT failed with:\n\n HTTP " +
34
+ response . status + ": " + response . responseText + "\n\nURL: " +
35
+ payload_url
36
+ tableau . abortWithError ( error_msg ) ;
37
+ throw new Error ( error_msg ) ;
38
+ }
39
+
40
+ return JSON . parse ( response . responseText ) ;
27
41
}
28
42
29
43
function get_matching_machines ( regexp ) {
You can’t perform that action at this time.
0 commit comments