Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

util: format as Error if instanceof Error #6352

Closed
wants to merge 1 commit into from
Closed

util: format as Error if instanceof Error #6352

wants to merge 1 commit into from

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Oct 15, 2013

Duplicate of #6350 but against master as per comment

Custom errors, subclasses of Error at least, should show up as errors and not empty objects with util.format() / console.log(). The objectToString() / Object.prototype.toString() call reaches in to the instance_class_name which I'm pretty sure we can't set in JS-land to make it return [object Error] hence the switch to instanceof.

Background: errors produced by errno's custom error utility produce '{}' with console.log().

@bnoordhuis
Copy link
Member

Thanks Rod, landed in 684dd28.

@bnoordhuis bnoordhuis closed this Oct 15, 2013
gibfahn pushed a commit to ibmruntimes/node that referenced this pull request May 6, 2016
History caching in the `readline` io is active only for terminal
interaction. Appropriate variables are initialized and relevant
`_addHistory()` function is called only if exposed `terminal` option
of `readline.createInterface()` is set `true` by user or internal
output check.

This clarification is useful to assure users there will be now wasted
overhead connected with history caching if `readline` is used not
for terminal interaction (e.g. for reading files line by line).

Particularly this fix is helpful after nodejs#6352 landing.

PR-URL: nodejs/node#6397
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
gibfahn pushed a commit to ibmruntimes/node that referenced this pull request May 6, 2016
History caching in the `readline` io is active only for terminal
interaction. Appropriate variables are initialized and relevant
`_addHistory()` function is called only if exposed `terminal` option
of `readline.createInterface()` is set `true` by user or internal
output check.

This clarification is useful to assure users there will be now wasted
overhead connected with history caching if `readline` is used not
for terminal interaction (e.g. for reading files line by line).

Particularly this fix is helpful after nodejs#6352 landing.

PR-URL: nodejs/node#6397
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants