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
This commit is contained in:
parent
437538644e
commit
4571a0ea0d
@ -258,16 +258,24 @@ SearchSystem.prototype = {
|
|||||||
if (isSubSearch) {
|
if (isSubSearch) {
|
||||||
for (let i = 0; i < this._previousResults.length; i++) {
|
for (let i = 0; i < this._previousResults.length; i++) {
|
||||||
let [provider, previousResults] = this._previousResults[i];
|
let [provider, previousResults] = this._previousResults[i];
|
||||||
let providerResults = provider.getSubsearchResultSet(previousResults, terms);
|
try {
|
||||||
if (providerResults.length > 0)
|
let providerResults = provider.getSubsearchResultSet(previousResults, terms);
|
||||||
results.push([provider, providerResults]);
|
if (providerResults.length > 0)
|
||||||
|
results.push([provider, providerResults]);
|
||||||
|
} catch (error) {
|
||||||
|
global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < this._providers.length; i++) {
|
for (let i = 0; i < this._providers.length; i++) {
|
||||||
let provider = this._providers[i];
|
let provider = this._providers[i];
|
||||||
let providerResults = provider.getInitialResultSet(terms);
|
try {
|
||||||
if (providerResults.length > 0)
|
let providerResults = provider.getInitialResultSet(terms);
|
||||||
results.push([provider, providerResults]);
|
if (providerResults.length > 0)
|
||||||
|
results.push([provider, providerResults]);
|
||||||
|
} catch (error) {
|
||||||
|
global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user