Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Record engine error in telemetry (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
eu9ene authored Feb 3, 2022
1 parent 03146fc commit c40f707
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 9 additions & 2 deletions extension/controller/translation/translationWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,15 @@ class TranslationHelper {
input.push_back(sourceParagraph);
});

// translate the input, which is a vector<String>; the result is a vector<Response>
let result = this.translationService.translate(translationModel, input, responseOptions);
let result = null;
try {
// translate the input, which is a vector<String>; the result is a vector<Response>
result = this.translationService.translate(translationModel, input, responseOptions);
} catch (e) {
console.error("Error in translation engine ", e)
postMessage(["onError", "marian"]);
throw e;
}

const translatedParagraphs = [];
for (let i = 0; i < result.size(); i+=1) {
Expand Down
2 changes: 0 additions & 2 deletions extension/mediator.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ class Mediator {
case "onError":
// payload is a metric name from metrics.yaml
this.telemetry.increment("errors", message.payload);
// submit errors ping right away assuming the rest of experience is broken
this.telemetry.submit("custom")
break;

case "onModelEvent":
Expand Down

0 comments on commit c40f707

Please sign in to comment.