From 5aee975512c8c4f87fdd211c18069296de994890 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 23 Aug 2005 14:29:23 +0000 Subject: [PATCH 1/1] moved exceptions here and no longer using instance of git-svn-id: svn://svn.open-ils.org/ILS/trunk@1702 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/RemoteRequest.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/opac/common/js/RemoteRequest.js b/Open-ILS/web/opac/common/js/RemoteRequest.js index 01be6eb9e7..e0b50ee99d 100644 --- a/Open-ILS/web/opac/common/js/RemoteRequest.js +++ b/Open-ILS/web/opac/common/js/RemoteRequest.js @@ -5,6 +5,17 @@ var XML_HTTP_MAX_TRIES = 3; var IAMXUL = false; function isXUL() { return IAMXUL; } +/* some communication exceptions */ +function EX(message) { this.init(message); } +EX.prototype.init = function(message) { this.message = message; } +EX.prototype.toString = function() { return "\n *** Exception Occured \n" + this.message; } +EXCommunication.prototype = new EX(); +EXCommunication.prototype.constructor = EXCommunication; +EXCommunication.baseClass = EX.prototype.constructor; +function EXCommunication(message) { this.classname="EXCommunication"; this.init("EXCommunication: " + message); } +/* ------------------------------------------------ */ + + var _allrequests = {}; function cleanRemoteRequests() { @@ -89,7 +100,7 @@ function _remoteRequestCallback(id) { /* if we receive a communication error, retry the request up to XML_HTTP_MAX_TRIES attempts */ - if( instanceOf(E, EXCommunication) ) { + if( E && E.classname == "EXCommunication" ) { if(object.sendCount >= XML_HTTP_MAX_TRIES ) { if(isXUL()) throw object; @@ -185,12 +196,12 @@ RemoteRequest.prototype.getResultObject = function() { if( obj[0] != null && obj[1] == null ) obj = obj[0]; /* these are user level exceptions from the server code */ - if(instanceOf(obj, ex)) { + if(obj.__isfieldmapper && obj.classname == "ex") { if(!isXUL()) alert(obj.err_msg()); throw obj; } - if(instanceOf(obj, perm_ex)) { + if(obj.__isfieldmapper && obj.classname == "perm_ex") { /* the opac will go ahead and spit out the error msg */ if(!isXUL()) alert(obj.err_msg()); throw obj; -- 2.43.2