Improve handling of webworker failures. - #1538
Open
dpvc wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1538 +/- ##
===========================================
- Coverage 86.93% 86.92% -0.02%
===========================================
Files 388 388
Lines 87571 87584 +13
Branches 3290 3291 +1
===========================================
+ Hits 76129 76130 +1
- Misses 11442 11454 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR sets things up to better handle failures in landing the speech worker or its maps, rather than just crash.
In
KeyExplorer.ts, we remove initial,(for when the speech is empty, as it will be if speech has failed). TheWord/Mathmessage is used when there should be speech, but speech hasn't been attached (i.e., speech has failed to be produced). This way, if the page is being read, you will at least get "math" as the output rather than nothing at all.In
speech.ts, the errors are always strings, not Error objects, so fixed that. InspeechError(), we only report non-empty messages (this is to help avoid getting a speech error for every math expression on the page when SRE fails; seeWebWorker.tsfor more).In
GeneratorPool.ts, if the worker failed to start, we produce a message indicating that rather than no speech or braille. An alternative (in a comment) is to use the text content of the selected element, but that might be pretty ugly. On the other hand, it would at least be specific to the node being walked.In
WebWorker.ts, we only report a termination warning once if the warning is the same. That way, if the worker doesn't load, you don't get a redundant warning for every expression on the page, but just one warning. We also don't throw an error when terminating if the worker hasn't started (since we need to terminate the tasks). Finally, we add some commands to handle failure to start the worker, and failure to load a map file. We check to see if the error already includes the path that failed, and if not add it ourselves.The
speech-worker.tsfile adds error handling to thegetMap()methods so that errors are reported back to MathJax rather than just logged to the console.Similarly, the HTMLAdaptor and NodeMixin adaptor are modified to include error trapping when the worker is started up.
Finally, the
asyncLoad()function is fixed to handlenode:references, which was lost somewhere along the line in the locale branch.