pcb-scene3d-viewer 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -234,6 +234,17 @@ export class PcbScene3dStepLoader {
234
234
  #handleWorkerMessage(event) {
235
235
  const activeRequest = this.#activeWorkerRequest
236
236
  this.#activeWorkerRequest = null
237
+ if (event?.data?.success === false && event.data.error) {
238
+ activeRequest?.reject(
239
+ new Error(
240
+ String(
241
+ event.data.error.message ||
242
+ 'STEP importer worker failed.'
243
+ )
244
+ )
245
+ )
246
+ return
247
+ }
237
248
  activeRequest?.resolve(event?.data || {})
238
249
  }
239
250
 
@@ -40,12 +40,18 @@ export class PcbScene3dWorkerClient {
40
40
 
41
41
  const requestId = 'scene3d-request-' + this.#requestSequence++
42
42
  this.#pendingRequests.set(requestId, { resolve, reject })
43
- this.#worker.postMessage({
44
- type: 'scene3d:prepare',
45
- requestId,
46
- documentModel,
47
- sessionAssets
48
- })
43
+ try {
44
+ this.#worker.postMessage({
45
+ type: 'scene3d:prepare',
46
+ requestId,
47
+ documentModel,
48
+ sessionAssets
49
+ })
50
+ } catch (error) {
51
+ // A synchronous clone failure will never receive a response.
52
+ this.#pendingRequests.delete(requestId)
53
+ reject(error)
54
+ }
49
55
  })
50
56
  }
51
57