From 4571a0ea0d68d9cfdbcd61fdff2b094954983382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor-bj=C3=B6rn=20Claesson?= Date: Tue, 21 Sep 2010 11:36:24 +0200 Subject: [PATCH] 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 file changed, 14 insertions(+), 6 deletions(-) diff --git a/js/ui/search.js b/js/ui/search.js index 2624f09aa..f2a991524 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); + } } }