Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
Allow intents to override some of what happens when they fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Sep 25, 2019
1 parent e06baaf commit 2cbe83c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extension/background/intentRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ this.intentRunner = (function() {
failed(message) {
telemetry.add({ intentSuccess: false });
telemetry.send({});
try {
this.onError(message);
} catch (e) {
log.error("Error in onError handler:", e);
}
return browser.runtime.sendMessage({
type: "displayFailure",
message,
Expand Down Expand Up @@ -62,6 +67,10 @@ this.intentRunner = (function() {
utteranceParsed: { slots: this.slots },
});
}

onError(message) {
// Can be overridden
}
}

exports.registerIntent = function(intent) {
Expand Down

0 comments on commit 2cbe83c

Please sign in to comment.