MCPcopy Create free account
hub / github.com/stenciljs/core / errorHandler

Function errorHandler

src/sys/node/node-worker-thread.ts:18–34  ·  view source on GitHub ↗
(stencilMsgId: number, err: any)

Source from the content-addressed store, hash-verified

16 };
17
18 const errorHandler = (stencilMsgId: number, err: any) => {
19 const errMsgBackToMain: d.MsgFromWorker<any> = {
20 stencilId: stencilMsgId,
21 stencilRtnValue: null,
22 stencilRtnError: 'Error',
23 };
24 if (typeof err === 'string') {
25 errMsgBackToMain.stencilRtnError += ': ' + err;
26 } else if (err) {
27 if (err.stack) {
28 errMsgBackToMain.stencilRtnError += ': ' + err.stack;
29 } else if (err.message) {
30 errMsgBackToMain.stencilRtnError += ':' + err.message;
31 }
32 }
33 process.send(errMsgBackToMain, sendHandle);
34 };
35
36 process.on('message', async <T extends d.WorkerContextMethod>(msgToWorker: d.MsgToWorker<T>) => {
37 // message from the main thread

Callers 1

initNodeWorkerThreadFunction · 0.85

Calls 1

sendMethod · 0.65

Tested by

no test coverage detected