Skip to content

Commit 1e6c05e

Browse files
committed
Remove debugging code
1 parent 84160b5 commit 1e6c05e

2 files changed

Lines changed: 7 additions & 31 deletions

File tree

lib/internal/modules/esm/hooks.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -498,33 +498,21 @@ class HooksProxy {
498498
}
499499

500500
TypedArrayPrototypeFill(this.#data, undefined); // Erase handled request/response data
501-
// console.log('sending request', method, args)
502501
const request = serialize({ method, args });
503502
TypedArrayPrototypeSet(this.#data, request);
504503

505-
// this.#awaitResponse();
506-
507504
const chunks = [];
508505
let done = false;
509506
try {
510507
while (done === false) {
511508
this.#awaitResponse();
512509

513510
const chunk = deserialize(this.#data);
514-
console.log('chunk:', chunk)
515-
516511
if (chunk instanceof Error) { throw chunk; }
517-
518512
({ done } = chunk);
519513
chunks.push(chunk.value);
520-
521-
console.log('awaiting next')
522514
}
523515
} catch (exception) {
524-
console.log('\nmakeRequest failed!\n');
525-
console.log(this.#data);
526-
console.log('byteLength:', this.#data.byteLength);
527-
console.log('this.#data[0]:', this.#data[0]);
528516
if (this.#data[0] === 0) { // Response should not be empty
529517
throw new ERR_INVALID_RETURN_VALUE('an object', method, undefined);
530518
} else {
@@ -533,9 +521,6 @@ class HooksProxy {
533521
}
534522

535523
const response = Buffer.concat(chunks);
536-
537-
console.log('[HooksProxy]::makeRequest() finished:', deserialize(response));
538-
539524
return response;
540525
}
541526

lib/internal/modules/esm/worker.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
'use strict';
22

3-
process.on('uncaughtException', (err) => {
4-
process._rawDebug('process uncaughtException:', new Error().stack);
5-
const { triggerUncaughtException } = internalBinding('errors');
6-
releaseLock();
7-
triggerUncaughtException(err);
8-
});
9-
103
const {
114
Int32Array,
125
ReflectApply,
@@ -49,7 +42,6 @@ function releaseLock() {
4942
try {
5043
initializeESM();
5144
hooks = await initializeHooks();
52-
process._rawDebug('[WORKER]:', 'hooks:', hooks);
5345
} catch (exception) {
5446
// If there was an error while parsing and executing a user loader, for example if because a loader contained a syntax error,
5547
// then we need to send the error to the main thread so it can be thrown and printed.
@@ -65,7 +57,6 @@ process._rawDebug('[WORKER]:', 'hooks:', hooks);
6557
Atomics.wait(lock, 0, 1); // This pauses the while loop
6658

6759
const { method, args } = deserialize(data);
68-
process._rawDebug('[WORKER]:', 'request received:', method, args);
6960
TypedArrayPrototypeFill(data, undefined);
7061

7162
// Each potential exception needs to be caught individually so that the correct error is sent to the main thread
@@ -85,26 +76,19 @@ process._rawDebug('[WORKER]:', 'hooks:', hooks);
8576
}
8677

8778
try {
88-
process._rawDebug('[WORKER]:', 'response:', response);
8979
const serializedResponseValue = serialize(response);
9080
const chunkCount = Math.ceil(serializedResponseValue.byteLength / CHUNK_THRESHOLD);
91-
process._rawDebug('[WORKER]:', 'chunkCount:', chunkCount)
9281
for (let i = 0; i < chunkCount; i++) {
9382
const chunk = {
9483
__proto__: null,
9584
done: i === chunkCount - 1,
9685
value: serializedResponseValue.slice(i),
9786
};
98-
process._rawDebug('[WORKER]:', 'chunk:', chunk);
9987
const serializedChunk = serialize(chunk);
100-
process._rawDebug('[WORKER]:', 'serializedChunk:', serializedChunk);
10188
// Send the method response (or exception) to the main thread
102-
10389
TypedArrayPrototypeSet(data, serializedChunk);
104-
// process._rawDebug('[WORKER]:', 'chunk set; releasing lock');
10590
releaseLock();
10691
}
107-
10892
} catch (exception) {
10993
TypedArrayPrototypeSet(data, serialize(exception));
11094
releaseLock();
@@ -118,3 +102,10 @@ process._rawDebug('[WORKER]:', 'hooks:', hooks);
118102
releaseLock();
119103
triggerUncaughtException(err);
120104
});
105+
106+
process.on('uncaughtException', (err) => {
107+
process._rawDebug('process uncaughtException:', new Error().stack);
108+
const { triggerUncaughtException } = internalBinding('errors');
109+
releaseLock();
110+
triggerUncaughtException(err);
111+
});

0 commit comments

Comments
 (0)