fix catching errors in the worker

This commit is contained in:
casperlamboo 2018-01-17 15:27:42 +01:00
parent 9f1958563d
commit 222a27d5b5
2 changed files with 4 additions and 4 deletions

View File

@ -63,10 +63,10 @@ function sliceAsync(settings, geometry, openObjectIndexes, constructLinePreview,
// create the slicer worker
const slicerWorker = new SlicerWorker();
slicerWorker.onerror = error => {
slicerWorker.addEventListener('error', event => {
slicerWorker.terminate();
reject(error);
};
reject(event);
});
// listen to messages send from worker
slicerWorker.addEventListener('message', (event) => {

View File

@ -12,7 +12,7 @@ const onProgress = progress => {
const loader = new JSONLoader();
self.addEventListener('message', async (event) => {
self.addEventListener('message', (event) => {
const { message, data } = event.data;
switch (message) {
case 'SLICE': {