Skip to content

node 9 loses error call site information in Buffer.concat #16994

Closed
@reviewher

Description

@reviewher
  • Version: node 9.1.0
  • Platform: darwin
var f = (function () {
});
var g = (function() {
	Buffer.concat([new Buffer(3), f]);
});
g();

This results in an error. Using node 8.9.1, the error message clearly indicates that the problem is in the source:

buffer.js:444
      throw new TypeError(kConcatErrMsg);
      ^

TypeError: "list" argument must be an Array of Buffer or Uint8Array instances
    at Function.Buffer.concat (buffer.js:444:13)
    at g (/tmp/t.js:4:9) <--- notice the reference to t.js here, this is expected
    at Object.<anonymous> (/tmp/t.js:6:1)
    at Module._compile (module.js:635:30)

In node 9.1.0, the error message appears to come from the core:

buffer.js:475
      throw kConcatErr;
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be one of type array, buffer, or uint8Array
    at buffer.js:450:20
    at NativeModule.compile (bootstrap_node.js:601:7)
    at NativeModule.require (bootstrap_node.js:546:18)
    at util.js:26:22
    at NativeModule.compile (bootstrap_node.js:601:7)
    at Function.NativeModule.require (bootstrap_node.js:546:18)
    at setupGlobalVariables (bootstrap_node.js:263:31)
    at startup (bootstrap_node.js:32:5)
    at bootstrap_node.js:613:3 

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions