{"id":13527838,"url":"https://github.com/mdlavin/nested-error-stacks","last_synced_at":"2025-04-04T08:09:44.401Z","repository":{"id":16137805,"uuid":"18883155","full_name":"mdlavin/nested-error-stacks","owner":"mdlavin","description":"A node.js module for creating Error objects with nested Errors in stacktraces","archived":false,"fork":false,"pushed_at":"2022-03-28T20:28:20.000Z","size":39,"stargazers_count":94,"open_issues_count":2,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T20:55:57.014Z","etag":null,"topics":["error-handling","javascript","nodejs","stack-traces"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdlavin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-17T15:23:29.000Z","updated_at":"2024-01-31T19:44:25.000Z","dependencies_parsed_at":"2022-09-06T05:21:17.924Z","dependency_job_id":null,"html_url":"https://github.com/mdlavin/nested-error-stacks","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlavin%2Fnested-error-stacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlavin%2Fnested-error-stacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlavin%2Fnested-error-stacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlavin%2Fnested-error-stacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdlavin","download_url":"https://codeload.github.com/mdlavin/nested-error-stacks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142074,"owners_count":20890653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["error-handling","javascript","nodejs","stack-traces"],"created_at":"2024-08-01T06:02:03.246Z","updated_at":"2025-04-04T08:09:44.386Z","avatar_url":"https://github.com/mdlavin.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Nested stacktraces for Node.js!\n===============================\n\n[![Build Status](https://github.com/mdlavin/nested-error-stacks/actions/workflows/test.yaml/badge.svg)](https://github.com/mdlavin/nested-error-stacks/actions?query=branch%3Amaster)\n[![NPM version](https://badge.fury.io/js/nested-error-stacks.svg)](http://badge.fury.io/js/nested-error-stacks)\n\nWith this module, you can wrap a caught exception with extra context\nfor better debugging.  For example, a network error's stack would normally look\nlike this:\n\n    Error: connect ECONNREFUSED\n        at errnoException (net.js:904:11)\n        at Object.afterConnect [as oncomplete] (net.js:895:19)\n\nUsing this module, you can wrap the Error with more context to get a stack\nthat looks like this:\n\n    NestedError: Failed to communicate with localhost:8080\n        at Socket.\u003canonymous\u003e (/Users/mattlavin/Projects/nested-stacks/demo.js:6:18)\n        at Socket.EventEmitter.emit (events.js:95:17)\n        at net.js:440:14\n        at process._tickCallback (node.js:415:13)\n    Caused By: Error: connect ECONNREFUSED\n        at errnoException (net.js:904:11)\n        at Object.afterConnect [as oncomplete] (net.js:895:19)\n\nHow to wrap errors\n------------------\n\nHere is an example program that uses this module to add more context to errors:\n\n```js\nvar NestedError = require('nested-error-stacks');\nvar net = require('net');\n    \nvar client = net.connect({port: 8080});\nclient.on('error', function (err) {\n    var newErr = new NestedError(\"Failed to communicate with localhost:8080\", err);\n    console.log(newErr.stack);\n});\n```\n\nHow to inherit\n--------------\n\nIt is recommended to use explicit names for Error classes. You can do it\nlike this:\n\n```js\nvar util = require('util');\nvar NestedError = require('nested-error-stacks');\n\nfunction MyError(message, nested) {\n    NestedError.call(this, message, nested);\n}\n\nutil.inherits(MyError, NestedError);\nMyError.prototype.name = 'MyError';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdlavin%2Fnested-error-stacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdlavin%2Fnested-error-stacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdlavin%2Fnested-error-stacks/lists"}