Closed ikokostya closed 9 years ago
Looks reasonable, redundant c-tor calls in the stacktrace is annoying. I'll review and test it, and merge or discuss solution here.
@golyshevd Error.captureStackTrace(this, this.constructor);
looks fine. I think, createError
method must be updated too to avoid meaningless call of createError
line as following:
SecondError: code two
at Function.Terror.createError (terror/lib/terror.js:259:17)
at Object.module.exports.stacktrace (terror/test/stacktrace.js:24:33)
^^^ SecondError.createError was called here ^^^
at Object.<anonymous> (terror/node_modules/nodeunit/lib/core.js:235:16)
at terror/node_modules/nodeunit/lib/core.js:235:16
at Object.exports.runTest (terror/node_modules/nodeunit/lib/core.js:69:9)
at terror/node_modules/nodeunit/lib/core.js:117:25
at terror/node_modules/nodeunit/deps/async.js:513:13
at iterate (terror/node_modules/nodeunit/deps/async.js:123:13)
at async.forEachSeries (terror/node_modules/nodeunit/deps/async.js:139:9)
at _concat (terror/node_modules/nodeunit/deps/async.js:512:9)
fixed in 1.0
branch, will be released and intergrated in another modules soon.
https://github.com/nodules/terror/commit/b3f3bdcefd02cef580df88d29cf551e326c98675