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
|
||||
|
||||
# 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.__implpy_(.*?)\)/property.call ($1, $1.__impl__$2)/g' eos/__javascript__/$f.js
|
||||
done
|
||||
|
@ -34,18 +34,25 @@ function generateEncryptedVote(election, answers, should_do_fingerprint) {
|
||||
}
|
||||
|
||||
onmessage = function(msg) {
|
||||
if (!isLibrariesLoaded) {
|
||||
importScripts(
|
||||
msg.data.static_base_url + "js/eosjs.js"
|
||||
);
|
||||
isLibrariesLoaded = true;
|
||||
}
|
||||
|
||||
if (msg.data.action === "generateEncryptedVote") {
|
||||
msg.data.election = eosjs.eos.core.objects.__all__.EosObject.deserialise_and_unwrap(msg.data.election, null);
|
||||
try {
|
||||
if (!isLibrariesLoaded) {
|
||||
importScripts(
|
||||
msg.data.static_base_url + "js/eosjs.js"
|
||||
);
|
||||
isLibrariesLoaded = true;
|
||||
}
|
||||
|
||||
generateEncryptedVote(msg.data.election, msg.data.answers);
|
||||
} else {
|
||||
throw "Unknown action: " + msg.data.action;
|
||||
if (msg.data.action === "generateEncryptedVote") {
|
||||
msg.data.election = eosjs.eos.core.objects.__all__.EosObject.deserialise_and_unwrap(msg.data.election, null);
|
||||
|
||||
generateEncryptedVote(msg.data.election, msg.data.answers);
|
||||
} else {
|
||||
throw "Unknown action: " + msg.data.action;
|
||||
}
|
||||
} catch (ex) {
|
||||
if (ex.__repr__) {
|
||||
throw ex.__repr__();
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user