Move onError catch into searchAt

This commit is contained in:
toasted-nutbread 2019-10-24 19:38:06 -04:00
parent 1039536cfb
commit d608657495

View File

@ -99,11 +99,7 @@ class Frontend {
} }
const search = async () => { const search = async () => {
try { await this.searchAt(e.clientX, e.clientY, 'mouse');
await this.searchAt(e.clientX, e.clientY, 'mouse');
} catch (e) {
this.onError(e);
}
}; };
if (scanningModifier === 'none') { if (scanningModifier === 'none') {
@ -314,12 +310,16 @@ class Frontend {
} }
async searchAt(x, y, cause) { async searchAt(x, y, cause) {
if (this.pendingLookup || await this.popup.containsPoint(x, y)) { try {
return; if (this.pendingLookup || await this.popup.containsPoint(x, y)) {
} return;
}
const textSource = docRangeFromPoint(x, y, this.options); const textSource = docRangeFromPoint(x, y, this.options);
return await this.searchSource(textSource, cause); return await this.searchSource(textSource, cause);
} catch (e) {
this.onError(e);
}
} }
async searchSource(textSource, cause) { async searchSource(textSource, cause) {
@ -503,15 +503,7 @@ class Frontend {
return; return;
} }
const search = async () => { this.searchAt(x, y, cause);
try {
await this.searchAt(x, y, cause);
} catch (e) {
this.onError(e);
}
};
search();
} }
selectionContainsPoint(selection, x, y) { selectionContainsPoint(selection, x, y) {