Skip to content

Commit

Permalink
Ensure reporting errors do not affect actions. Fixes #1116
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Oct 27, 2020
1 parent 6f4a5ac commit 53e7f17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/actions-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ SnapActions.onReceiveAction = function(msg) {
};

SnapActions.completeAction = function(error) {
const result = ActionManager.prototype.completeAction.apply(this, arguments);
if (error) {
this.ide().submitBugReport(null, error);
}
return ActionManager.prototype.completeAction.apply(this, arguments);
return result;
};

SnapActions.submitIfAllowed = function(event) {
Expand Down
6 changes: 5 additions & 1 deletion src/netsblox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,11 @@ NetsBloxMorph.prototype.submitBugReport = function (desc, error) {
report.clientUuid = this.sockets.uuid;

// Add screenshot
report.screenshot = canvas.toDataURL('image/png');
try {
report.screenshot = canvas.toDataURL('image/png');
} catch (err) {
console.warn(`Unable to capture screenshot for bug report`, err);
}

// Add project state
report.project = this.serializer.serialize(this.stage);
Expand Down

0 comments on commit 53e7f17

Please sign in to comment.