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 1818 "hash" : tableau . dataTypeEnum . string ,
1919 "code_size" : tableau . dataTypeEnum . int } ;
2020
21+ /** Get a json payload from the LNT server asynchronously or error.
22+ * @param {string } payload_url JSON payloads URL.
23+ */
2124 function getValue ( payload_url ) {
22- var value = $ . ajax ( {
25+ var response = $ . ajax ( {
2326 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 ) ;
2741 }
2842
2943 function get_matching_machines ( regexp ) {
You can’t perform that action at this time.
0 commit comments