Title: doc:Error:captureStackTrace description inaccurate · Issue #5675 · nodejs/node · GitHub
Open Graph Title: doc:Error:captureStackTrace description inaccurate · Issue #5675 · nodejs/node
X Title: doc:Error:captureStackTrace description inaccurate · Issue #5675 · nodejs/node
Description: From at least Node 4.2 the documentation says: The first line of the trace, instead of being prefixed with ErrorType: message, will be the result of calling targetObject.toString(). This test program: var assert = require('assert'); func...
Open Graph Description: From at least Node 4.2 the documentation says: The first line of the trace, instead of being prefixed with ErrorType: message, will be the result of calling targetObject.toString(). This test progr...
X Description: From at least Node 4.2 the documentation says: The first line of the trace, instead of being prefixed with ErrorType: message, will be the result of calling targetObject.toString(). This test progr...
Opengraph URL: https://github.com/nodejs/node/issues/5675
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"doc:Error:captureStackTrace description inaccurate","articleBody":"From at least Node 4.2 the [documentation](https://nodejs.org/dist/latest-v4.x/docs/api/errors.html#errors_error_capturestacktrace_targetobject_constructoropt) says:\n\n> The first line of the trace, instead of being prefixed with `ErrorType:\n> message`, will be the result of calling `targetObject.toString()`.\n\nThis test program:\n\n```\nvar assert = require('assert');\n\nfunction X(msg) {\n this.message = msg;\n}\nX.prototype.name = 'X';\nX.prototype.toString = function() { return 'toString'; }\n\nvar x = new X('something');\nassert.deepEqual(x, {message: 'something'});\nassert.equal(x.toString(), 'toString');\n\nError.captureStackTrace(x);\nassert.equal(x.stack.split('\\n')[0], 'X: something');\n```\n\nproves the description incorrect. The first line is produced by `deps/v8/src/messages.js` in `ErrorToStringDetectCycle` from the `name` and `message` properties of `targetObject` with this logic:\n\n```\nif (name === \"\") return message;\nif (message === \"\") return name;\nreturn name + \": \" + message;\n```\n\nwhere `name` defaults to `\"Error\"` and `message` defaults to `\"\"`.\n\nI'm not good at user-facing technical documentation so I'd rather not try to craft replacement text for something that complex.\n","author":{"url":"https://github.com/pabigot","@type":"Person","name":"pabigot"},"datePublished":"2016-03-12T13:07:11Z","url":"https://github.com/nodejs/node/issues/5675"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c69bc6e5-899e-99f7-ff96-ec29c386a2d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6C4:169E62:103A820:151CF2B:6AED5C93 |
| html-safe-nonce | 1c4536062ae3ba12df2cfce9fadf55bfeb256e5fcbf9c2ade027cc5bd07748c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkM0OjE2OUU2MjoxMDNBODIwOjE1MUNGMkI6NkFFRDVDOTMiLCJ2aXNpdG9yX2lkIjoiODUzOTYxNDI1ODczNzc5ODI5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 608eae24bde8df196b49897f3a8da18fe6dbd102e1a06edfeaa6157b2c6226f9 |
| hovercard-subject-tag | issue:140381951 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/5675/issue_layout |
| twitter:image | https://opengraph.githubassets.com/929449087de5a538e22f65d767085e81056cfe68a2c292713e1ab8d8071b2b45/nodejs/node/issues/5675 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/929449087de5a538e22f65d767085e81056cfe68a2c292713e1ab8d8071b2b45/nodejs/node/issues/5675 |
| og:image:alt | From at least Node 4.2 the documentation says: The first line of the trace, instead of being prefixed with ErrorType: message, will be the result of calling targetObject.toString(). This test progr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pabigot |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width