Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an extra try/catch for errors in the FP script #139

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/js/web_accessible/fingercounting.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ function listen(func) {
function getScriptLocation() { // todo: to do split('\n') we do a O(n) read of the stack, this could be reduced by a constant factor by only reading to the third '\n'. but this is micro optimisation
let lines = (new Error()).stack.split('\n');
try {
return getUrlFromStackLine(lines[3]);
} catch (e) {
return getUrlFromStackLine(lines[2]);
}
try {
return getUrlFromStackLine(lines[3]);
} catch (e) {
return getUrlFromStackLine(lines[2]);
} catch (e) {}
}

const urlEndRegex = /^.*?.(?=(\?|#|:(?!\/\/)))/,
Expand Down