diff --git a/res/index.html b/res/index.html
index 78b00ac5..a6f7a1ec 100644
--- a/res/index.html
+++ b/res/index.html
@@ -6,32 +6,32 @@
+
+
An error happened. :(
+
-
- You can:
-
+ Please report it:
+
- Useful details to mention:
+ Useful details to mention (auto-included if you use the create/email links above):
+
diff --git a/src/circuit/CircuitStats.js b/src/circuit/CircuitStats.js
index 646907f5..3599f6db 100644
--- a/src/circuit/CircuitStats.js
+++ b/src/circuit/CircuitStats.js
@@ -128,7 +128,7 @@ export default class CircuitStats {
return CircuitStats._fromCircuitAtTime_noFallback(circuitDefinition, time);
} catch (ex) {
notifyAboutRecoveryFromUnexpectedError(
- "Computing circuit values failed. Defaulted to NaN results.",
+ `Defaulted to NaN results. Computing circuit values failed.`,
{circuitDefinition: Serializer.toJson(circuitDefinition)},
ex);
return new CircuitStats(
diff --git a/src/fallback.js b/src/fallback.js
index f52aea11..9ae4df3f 100644
--- a/src/fallback.js
+++ b/src/fallback.js
@@ -2,12 +2,25 @@ import describe from "src/base/Describe.js"
let _alreadySeen = [];
let showErrorDiv = (subject, body) => {
+ let errDivStyle = document.getElementById('errorDiv').style;
+ if (errDivStyle.opacity < 0.7) {
+ // Partially faded away as user interacted with circuit.
+ // Enough time to justify updating the message despite the risk of clearing the user's selection.
+ _alreadySeen = [];
+ }
+
+ // Error just happened, so this should be showing and highlighted.
+ errDivStyle.backgroundColor = '#FFA';
+ errDivStyle.opacity = 1.0;
+ errDivStyle.display = 'block';
+
if (_alreadySeen.indexOf(body) !== -1) {
return;
}
_alreadySeen.push(body);
- document.getElementById('errorDiv').style.display = 'block';
+ // Set shown error details.
+ document.getElementById('errorMessageDiv').innerText = subject;
document.getElementById('errorDescDiv').innerText = body;
document.getElementById('error-mailto-anchor').innerText = 'Email the issue to craig.gidney@gmail.com';
document.getElementById('error-mailto-anchor').href = [
@@ -54,10 +67,10 @@ let notifyAboutRecoveryFromUnexpectedError = (recovery, context, error) => {
simplifySrcUrls(location)
].join('\n');
- showErrorDiv(recovery, msg);
+ showErrorDiv(recovery + ' (' + (error.message || '') + ')', msg);
};
-let simplifySrcUrls = textContainingUrls => textContainingUrls.replace(/http.+\/src\.min\.js/g, 'src.min.js');
+let simplifySrcUrls = textContainingUrls => textContainingUrls.replace(/http.+?\/src\.min\.js/g, 'src.min.js');
let drawErrorBox = msg => {
let canvas = document.getElementById("drawCanvas");
diff --git a/src/main.js b/src/main.js
index 5f616788..d507c97c 100644
--- a/src/main.js
+++ b/src/main.js
@@ -124,6 +124,13 @@ const redrawNow = () => {
let painter = new Painter(canvas);
let shown = syncArea(inspector).previewDrop();
if (!currentCircuitStatsCache.circuitDefinition.isEqualTo(shown.circuitWidget.circuitDefinition)) {
+ // Maybe this fresh new circuit isn't failing. Clear the error tint.
+ let errDivStyle = document.getElementById('errorDiv').style;
+ errDivStyle.opacity *= 0.9;
+ if (errDivStyle.opacity < 0.06) {
+ errDivStyle.display = 'None'
+ }
+
currentCircuitStatsCache =
new CycleCircuitStats(shown.circuitWidget.circuitDefinition, Config.TIME_CACHE_GRANULARITY);
}