some error handling
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Jul 2005 12:11:28 +0000 (12:11 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Jul 2005 12:11:28 +0000 (12:11 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1470 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/cat/browse_list.js
Evergreen/staff_client/chrome/content/evergreen/cat/copy_edit.js
Evergreen/staff_client/chrome/content/evergreen/cat/marc.js
Evergreen/staff_client/chrome/content/evergreen/cat/record_list.js
Evergreen/staff_client/chrome/content/evergreen/cat/volume.js

index a518bce..b61485c 100644 (file)
@@ -150,11 +150,16 @@ function gather_copies() {
                        gather_copies_callback
                );
 */
-       var orgs_with_copies = user_request(
-               'open-ils.cat',
-               'open-ils.cat.actor.org_unit.retrieve_by_title',
-               [ find_this_id ]
-       )[0];
+       var orgs_with_copies = [];
+       try {
+               orgs_with_copies = user_request(
+                       'open-ils.cat',
+                       'open-ils.cat.actor.org_unit.retrieve_by_title',
+                       [ find_this_id ]
+               )[0];
+       } catch(E) {
+               handle_error(E);
+       }
        for (var i = 0; i < orgs_with_copies.length; i++) {
                orgs_with_copies_hash[ orgs_with_copies[i] ] = true;
        }
@@ -629,12 +634,16 @@ function volume_delete(tab,params) {
                cn.isdeleted( '1' );
                cn_list.push( cn );
        }
-       var result = user_request(
-                       'open-ils.cat',
-                       'open-ils.cat.asset.volume_tree.fleshed.batch.update',
-                       [ mw.G['auth_ses'][0], cn_list]
-       );
-       mw.sdump('D_CAT','volume_tree.fleshed.batch.update result: ' + js2JSON(result) + '\n');
+       try {
+               var result = user_request(
+                               'open-ils.cat',
+                               'open-ils.cat.asset.volume_tree.fleshed.batch.update',
+                               [ mw.G['auth_ses'][0], cn_list]
+               );
+               mw.sdump('D_CAT','volume_tree.fleshed.batch.update result: ' + js2JSON(result) + '\n');
+       } catch(E) {
+               handle_error(E);
+       }
        refresh_browse_list();
 }
 
@@ -652,11 +661,15 @@ function copy_delete(tab,params) {
                cn.copies( [ cp ] );
                cn_list.push( cn );
        }
-       var result = user_request(
-                       'open-ils.cat',
-                       'open-ils.cat.asset.volume_tree.fleshed.batch.update',
-                       [ mw.G['auth_ses'][0], cn_list]
-       );
-       mw.sdump('D_CAT','volume_tree.fleshed.batch.update result: ' + js2JSON(result) + '\n');
+       try {
+               var result = user_request(
+                               'open-ils.cat',
+                               'open-ils.cat.asset.volume_tree.fleshed.batch.update',
+                               [ mw.G['auth_ses'][0], cn_list]
+               );
+               mw.sdump('D_CAT','volume_tree.fleshed.batch.update result: ' + js2JSON(result) + '\n');
+       } catch(E) {
+               handle_error(E);
+       }
        refresh_browse_list();
 }
index ed70a9b..5910076 100644 (file)
@@ -20,11 +20,16 @@ function copy_edit_init() {
                }
        );
        mw.sdump('D_CAT','id_mapped_list.length = ' + id_mapped_list.length + '\n');
-       var result = user_request(
-               'open-ils.search',
-               'open-ils.search.asset.copy.fleshed.batch.retrieve', 
-               [ id_mapped_list ]
-       )[0];
+       var result = [];
+       try {
+               result = user_request(
+                       'open-ils.search',
+                       'open-ils.search.asset.copy.fleshed.batch.retrieve', 
+                       [ id_mapped_list ]
+               )[0];
+       } catch(E) {
+               handle_error(E);
+       }
        mw.sdump('D_CAT','result.length = ' + result.length + '\n');
        cn_list = new Array();
        for (var i in result) {
index 4b025ce..918631e 100644 (file)
@@ -91,11 +91,16 @@ function my_resize_handler(ev) {
 
 function retrieve_record(id) {
        mw.sdump('D_CAT','Entering retrieve_record() : ' + timer_elapsed('cat') + '\n');
-       var result = user_request(
-               'open-ils.cat',
-               'open-ils.cat.biblio.record.tree.retrieve',
-               [ id ]
-       );
+       var result;
+       try {
+               result = user_request(
+                       'open-ils.cat',
+                       'open-ils.cat.biblio.record.tree.retrieve',
+                       [ id ]
+               );
+       } catch(E) {
+               handle_error(E);
+       }
        //var result = [ JSON2js( test_nodeset() ) ];
        /*var result = user_request(
                'open-ils.cat',
@@ -119,11 +124,16 @@ function retrieve_record(id) {
 
 function retrieve_meta_record(id) {
        mw.sdump('D_CAT','Entering retrieve_meta_record() : ' + timer_elapsed('cat') + '\n');
-       var result = user_request(
-               'open-ils.cat',
-               'open-ils.cat.biblio.record.metadata.retrieve',
-               [ id ]
-       );
+       var result;
+       try {
+               result = user_request(
+                       'open-ils.cat',
+                       'open-ils.cat.biblio.record.metadata.retrieve',
+                       [ id ]
+               );
+       } catch(E) {
+               handle_error(E);
+       }
        if (typeof(result[0]) != 'object') {
                alert( 'user_request gave ' + js2JSON(result) );
                mw.sdump('D_CAT','Exiting retrieve_meta_record() : ' + timer_elapsed('cat') + '\n');
index faf8e69..1dd5af3 100644 (file)
@@ -48,18 +48,26 @@ function search() {
        mw.sdump('D_CAT','search_type = ' + search_type + '  search_order = ' + search_order + '  search_term = ' + search_term + '\n');
        switch(search_type) {
                case 'tcn':
-                       result = user_request(
-                               'open-ils.search',
-                               'open-ils.search.cat.biblio.tcn',
-                               [ search_term ]
-                       );
+                       try {
+                               result = user_request(
+                                       'open-ils.search',
+                                       'open-ils.search.cat.biblio.tcn',
+                                       [ search_term ]
+                               );
+                       } catch(E) {
+                               handle_error(E);
+                       }
                        break;
                default:
-                       result = user_request(
-                               'open-ils.search',
-                               'open-ils.search.cat.biblio.class',
-                               [ search_location, search_type, search_order, search_term ]
-                       );
+                       try {
+                               result = user_request(
+                                       'open-ils.search',
+                                       'open-ils.search.cat.biblio.class',
+                                       [ search_location, search_type, search_order, search_term ]
+                               );
+                       } catch(E) {
+                               handle_error(E);
+                       }
                        break;
        }
        // populate record_list with results
index 8b81822..7442ff7 100644 (file)
@@ -302,12 +302,16 @@ function build_page_four() {
 }
 
 function send_to_bill() {
-       var result = user_request(
-                       'open-ils.cat',
-                       'open-ils.cat.asset.volume_tree.fleshed.batch.update',
-                       [ mw.G['auth_ses'][0], cn_list]
-       );
-       mw.sdump('D_CAT','volume_tree.fleshed.batch.update result: ' + js2JSON(result) + '\n');
+       try {
+               var result = user_request(
+                               'open-ils.cat',
+                               'open-ils.cat.asset.volume_tree.fleshed.batch.update',
+                               [ mw.G['auth_ses'][0], cn_list]
+               );
+               mw.sdump('D_CAT','volume_tree.fleshed.batch.update result: ' + js2JSON(result) + '\n');
+       } catch(E) {
+               handle_error(E);
+       }
        refresh_spawning_browse_list();
 }