Skip to content

child_process, process: possibly confusing error message #20314

@vsemozhetbyt

Description

@vsemozhetbyt
  • Version: all?
  • Platform: all?
  • Subsystem: child_process, process

parent.js:

'use strict';

const subprocess = require('child_process').fork('subprocess.js');

try {
  subprocess.send(Symbol());
} catch (err) {
  console.error('PARENT error:', err);
}

subprocess.js:

'use strict';

process.on('uncaughtException', (err) => {
  console.log('SUBPROCESS error:', err);
});

process.on('message', (msg) => {
  console.log('SUBPROCESS got message:', msg);
});

Output:

SUBPROCESS error: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Pipe.channel.onread (internal/child_process.js:492:28)
  1. Should we intercept unserializable values at the sending side?
  2. If not, should we make the error message on receiving side more clear?

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.errorsIssues and PRs related to JavaScript errors originated in Node.js core.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions