镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

child_process, process: possibly confusing error message #20314

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?

Activity

  1. added
    child_processIssues and PRs related to the child_process subsystem.
    processIssues and PRs related to the process subsystem.
    errorsIssues and PRs related to JavaScript errors originating in Node.js core.
    on Apr 26, 2018
  2. joyeecheung commented on Apr 26, 2018

    @joyeecheung
    Member

    Option 1 SGTM.

  3. vsemozhetbyt commented on Mar 18, 2019

    @vsemozhetbyt
    ContributorAuthor

    This seems addressed in daa97df

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.errorsIssues and PRs related to JavaScript errors originating 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