[gnome-shell] Add basic error handling to search system.



commit 4571a0ea0d68d9cfdbcd61fdff2b094954983382
Author: Tor-björn Claesson <tclaesson gmail com>
Date:   Tue Sep 21 11:36:24 2010 +0200

    Add basic error handling to search system.
    
    If a search provider misbehaves, the search system fails to return any
    results from any providers. Work around this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=627950

 js/ui/search.js |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index 2624f09..f2a9915 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -258,16 +258,24 @@ SearchSystem.prototype = {
         if (isSubSearch) {
             for (let i = 0; i < this._previousResults.length; i++) {
                 let [provider, previousResults] = this._previousResults[i];
-                let providerResults = provider.getSubsearchResultSet(previousResults, terms);
-                if (providerResults.length > 0)
-                    results.push([provider, providerResults]);
+                try {
+                    let providerResults = provider.getSubsearchResultSet(previousResults, terms);
+                    if (providerResults.length > 0)
+                        results.push([provider, providerResults]);
+                } catch (error) {
+                    global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
+                }
             }
         } else {
             for (let i = 0; i < this._providers.length; i++) {
                 let provider = this._providers[i];
-                let providerResults = provider.getInitialResultSet(terms);
-                if (providerResults.length > 0)
-                    results.push([provider, providerResults]);
+                try {
+                    let providerResults = provider.getInitialResultSet(terms);
+                    if (providerResults.length > 0)
+                        results.push([provider, providerResults]);
+                } catch (error) {
+                    global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
+                }
             }
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]