From 64031cbfa0e5674292819b7f8ccb997c47d46dc8 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 8 Aug 2006 13:34:24 +0000 Subject: [PATCH] fixed some issues with the network failure handling git-svn-id: svn://svn.open-ils.org/ILS/trunk@5360 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/RemoteRequest.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/opac/common/js/RemoteRequest.js b/Open-ILS/web/opac/common/js/RemoteRequest.js index df92b13af0..f1b1840da7 100644 --- a/Open-ILS/web/opac/common/js/RemoteRequest.js +++ b/Open-ILS/web/opac/common/js/RemoteRequest.js @@ -7,6 +7,9 @@ var XML_HTTP_MAX_TRIES = 3; /* This object is thrown when network failures occur */ function NetworkFailure(stat) { this.status = stat; } NetworkFailure.prototype.status = function() { return this.status; } +NetworkFailure.prototype.toString = function() { + return "Network Failure: status = " + this.status; +} @@ -262,13 +265,20 @@ RemoteRequest.prototype.getResultObject = function() { if(this.cancelled) return null; if(!this.xmlhttp) return null; + var failed = false; + var status = null; + try { - if( this.xmlhttp.status != 200 ) { - try{dump('! NETWORK FAILURE. HTTP STATUS = ' - + this.xmlhttp.status);}catch(e){} - throw new NetworkFailure(this.xmlhttp.status); - } - } catch(e) {} + status = this.xmlhttp.status; + if( status != 200 ) failed = true; + } catch(e) { failed = true; } + + + if( failed ) { + if(!status) status = ''; + try{dump('! NETWORK FAILURE. HTTP STATUS = ' +status);}catch(e){} + throw new NetworkFailure(status); + } this.event(null); -- 2.11.0