cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
521 stars 270 forks source link

[Bug] can not catch the error occur in webWorker #782

Open Hamusuta0320 opened 11 months ago

Hamusuta0320 commented 11 months ago

Describe the Bug

When an error occur in web worker task, i can not be catch. because the handle function in decodeTask file is async, need to catch it with await it.

Steps to Reproduce

while an error occur in webWorker, such as 'target array for image does not have the same length as the decoded image length'

The current behavior

can not catch the error occur in webWorker.

The expected behavior

catch the error occur in webWorker.

OS

Windows11

Node version

v18.17.1

Browser

Chrome 116.0.5845.180

sedghi commented 11 months ago

if the error says it is not the same length I guess it is good that we are not catching it and throwing explicitly. Why do you want to catch it?

Hamusuta0320 commented 10 months ago

if the error says it is not the same length I guess it is good that we are not catching it and throwing explicitly. Why do you want to catch it?

I want a way to know if the web worker is processing correctly. If errors can be caught, corresponding actions can be performed, such as displaying errors on the interface