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

Commit

Permalink
Fix #310, display text of error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Sep 27, 2019
1 parent ea2ed25 commit 345b9bc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
17 changes: 14 additions & 3 deletions extension/background/intentRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,20 @@ this.intentRunner = (function() {
// isn't actually complete:
telemetry.send();
} catch (e) {
context.failed(`Internal error: ${e}`);
log.error("Error in intent", desc.name, ":", String(e), e.stack);
catcher.capture(e);
const display = e.displayMessage || `Internal error: ${e}`;
context.failed(display);
if (e.displayMessage) {
log.info(
"Expected error in intent",
desc.name,
":",
String(e),
e.stack
);
} else {
log.error("Error in intent", desc.name, ":", String(e), e.stack);
catcher.capture(e);
}
}
};

Expand Down
11 changes: 9 additions & 2 deletions extension/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ body,
display: block;
}

.listening :-moz-any(#transcript, #popup-settings, #back-icon, #card) {
.listening
:-moz-any(#transcript, #popup-settings, #back-icon, #card, #error-message) {
display: none;
}

.processing
:-moz-any(#suggestions, #feedback, #popup-settings, #back-icon, #card) {
:-moz-any(#suggestions, #feedback, #popup-settings, #back-icon, #card, #error-message) {
display: none;
}

Expand Down Expand Up @@ -169,6 +170,12 @@ body,
padding: 1.5rem 0;
}

#error-message {
font-weight: 600;
padding: 1.5rem 0;
color: #800;
}

#text-input-field {
font-size: 20px;
caret-color: transparent;
Expand Down
1 change: 1 addition & 0 deletions extension/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
</div>
</div>
<div id="transcript"></div>
<div id="error-message"></div>
<div id="feedback">
<div id="feedback-prompt">
How was your last experience?
Expand Down
3 changes: 3 additions & 0 deletions extension/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ this.popup = (function() {
ui.showCard(message.cardData);
} else if (message.type === "displayFailure") {
ui.setState("error");
if (message.message) {
ui.setErrorMessage(message.message);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions extension/popup/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ this.ui = (function() {
document.querySelector("#transcript").textContent = transcript;
};

exports.setErrorMessage = function setErrorMessage(message) {
document.querySelector("#error-message").textContent = message;
};

exports.setIcon = function setIcon(state) {
browser.browserAction.setIcon({
16: `${state}-16.svg`,
Expand Down

0 comments on commit 345b9bc

Please sign in to comment.