Closed
Description
This is an error report for node v10 which has already been fixed for node v12 and may make sense to fix in node v10 as well. The fix in node v12 could have been made via pull request #30576 .
- Version: 10.21.0
- Platform: Mac OS X
- Subsystem: util
What steps will reproduce the bug?
'use strict'
let util = require('util')
let err1 = new Error()
let err2 = new Error()
err2.stack = String(err2.stack).split('\n') // This breaks it.
util.inspect(err1) // -> OK
util.inspect(err2) // -> OK
util.inspect({ err1 }) // -> OK
util.inspect({ err2 }) // -> TypeError: formatError(...).replace is not a function
How often does it reproduce? Is there a required condition?
Every time in node v10.21.0. Never in node v12.16.1.
What is the expected behavior?
The err2.stack
array is inspected as an array would usually be inspected.
What do you see instead?
util.inspect({ err2 })
throws this error: TypeError: formatError(...).replace is not a function
Additional information
Feel free to close if such a fix is not within the scope of the LTS maintenance phase in which node v10 is currently in.