Improve error handling in worker
This commit is contained in:
parent
d71e9e4821
commit
36cb4defe2
@ -31,7 +31,7 @@ for f in eos.js_tests; do
|
|||||||
perl -0777 -pi -e 's/__except0__.__cause__ = null;//g' eos/__javascript__/$f.js
|
perl -0777 -pi -e 's/__except0__.__cause__ = null;//g' eos/__javascript__/$f.js
|
||||||
|
|
||||||
# Fix handling of properties, Transcrypt bug #407
|
# Fix handling of properties, Transcrypt bug #407
|
||||||
perl -077 -pi -e 's/var __get__ = function \(self, func, quotedFuncName\) \{/var __get__ = function (self, func, quotedFuncName) { if(typeof(func) != "function"){return func;}/g' eos/__javascript__/$f.js
|
perl -0777 -pi -e 's/var __get__ = function \(self, func, quotedFuncName\) \{/var __get__ = function (self, func, quotedFuncName) { if(typeof(func) != "function"){return func;}/g' eos/__javascript__/$f.js
|
||||||
perl -0777 -pi -e 's/property.call \((.*?), \g1.\g1.__impl__(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
|
perl -0777 -pi -e 's/property.call \((.*?), \g1.\g1.__impl__(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
|
||||||
perl -0777 -pi -e 's/property.call \((.*?), \g1.\g1.__implpy_(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
|
perl -0777 -pi -e 's/property.call \((.*?), \g1.\g1.__implpy_(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
|
||||||
done
|
done
|
||||||
|
@ -34,18 +34,25 @@ function generateEncryptedVote(election, answers, should_do_fingerprint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onmessage = function(msg) {
|
onmessage = function(msg) {
|
||||||
if (!isLibrariesLoaded) {
|
try {
|
||||||
importScripts(
|
if (!isLibrariesLoaded) {
|
||||||
msg.data.static_base_url + "js/eosjs.js"
|
importScripts(
|
||||||
);
|
msg.data.static_base_url + "js/eosjs.js"
|
||||||
isLibrariesLoaded = true;
|
);
|
||||||
}
|
isLibrariesLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.data.action === "generateEncryptedVote") {
|
if (msg.data.action === "generateEncryptedVote") {
|
||||||
msg.data.election = eosjs.eos.core.objects.__all__.EosObject.deserialise_and_unwrap(msg.data.election, null);
|
msg.data.election = eosjs.eos.core.objects.__all__.EosObject.deserialise_and_unwrap(msg.data.election, null);
|
||||||
|
|
||||||
generateEncryptedVote(msg.data.election, msg.data.answers);
|
generateEncryptedVote(msg.data.election, msg.data.answers);
|
||||||
} else {
|
} else {
|
||||||
throw "Unknown action: " + msg.data.action;
|
throw "Unknown action: " + msg.data.action;
|
||||||
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
if (ex.__repr__) {
|
||||||
|
throw ex.__repr__();
|
||||||
|
}
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user