{"id":32744616,"url":"https://github.com/leonardofurnielis/node-error-handler","last_synced_at":"2025-12-24T20:57:59.960Z","repository":{"id":35032497,"uuid":"187531751","full_name":"leonardofurnielis/node-error-handler","owner":"leonardofurnielis","description":"Express error handler for JSON APIs in development and production-ready environments.","archived":false,"fork":false,"pushed_at":"2024-02-24T04:29:21.000Z","size":497,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-24T15:36:37.726Z","etag":null,"topics":["api","error","error-handling","express","handler","json","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/node-error-handler","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/leonardofurnielis.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-05-19T21:51:49.000Z","updated_at":"2022-10-05T19:56:25.000Z","dependencies_parsed_at":"2022-08-08T04:00:58.642Z","dependency_job_id":null,"html_url":"https://github.com/leonardofurnielis/node-error-handler","commit_stats":null,"previous_names":["leofur1/http-json-error-handler"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/leonardofurnielis/node-error-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardofurnielis%2Fnode-error-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardofurnielis%2Fnode-error-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardofurnielis%2Fnode-error-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardofurnielis%2Fnode-error-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonardofurnielis","download_url":"https://codeload.github.com/leonardofurnielis/node-error-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardofurnielis%2Fnode-error-handler/sbom","scorecard":{"id":584653,"data":{"date":"2025-08-11","repo":{"name":"github.com/leonardofurnielis/node-error-handler","commit":"e3ca8605c752a1eda6d4f4cadc30ca7f809922b2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/leonardofurnielis/node-error-handler/build-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/leonardofurnielis/node-error-handler/build-test.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/build-test.yml:29","Warn: npmCommand not pinned by hash: .github/workflows/build-test.yml:30","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T20:07:37.415Z","repository_id":35032497,"created_at":"2025-08-20T20:07:37.415Z","updated_at":"2025-08-20T20:07:37.415Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282486446,"owners_count":26677171,"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","status":"online","status_checked_at":"2025-11-03T02:00:05.676Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","error","error-handling","express","handler","json","nodejs"],"created_at":"2025-11-03T16:05:24.378Z","updated_at":"2025-11-03T16:05:28.230Z","avatar_url":"https://github.com/leonardofurnielis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-error-handler\n\n![npm](https://img.shields.io/npm/v/node-error-handler)\n![workflow](https://github.com/leonardofurnielis/node-error-handler/actions/workflows/build-test.yml/badge.svg)\n[![codecov](https://codecov.io/gh/leonardofurnielis/node-error-handler/branch/master/graph/badge.svg)](https://codecov.io/gh/leonardofurnielis/node-error-handler)\n![GitHub](https://img.shields.io/github/license/leonardofurnielis/node-error-handler.svg)\n![npm](https://img.shields.io/npm/dm/node-error-handler.svg)\n\n## Installation \n\n```bash\nnpm install node-error-handler --save\n```\n\n## Usage\n\nIn an [express](https://www.npmjs.com/package/express) based application:\n\n```js\nconst  express = require('express');\nconst  error_handler = require('node-error-handler');\n  \nconst  app = express();\n\n// Handling GET request to '/foo' endpoint\napp.get('/foo', (req, res, next) =\u003e {\n  // Creating a new Error object with a custom message\n  const  error = new  Error('Missing field: `name`');\n  // Setting a custom error code\n  error.code = 422;\n  \n  // Passing the error to the next middleware function\n  next(error);\n});\n\n// Adding error handling middleware\napp.use(error_handler({ \n  debug: true, // Enable debug mode\n  trace: app.get('env') === 'development', // Enable trace if environment is set to development\n  camel_case: true // Convert error keys to camel case\n  }));\n```\n\n## Options\n\n| Option | Type | Default | Description  |\n| ------ |------|---------| ------------ |\n| debug | Boolean | `false`| If `true` all errors are printed with stderr. |\n| trace| Boolean | `false` | If `true` the trace is attached to output. (Recommended use in development only) |\n| camel_case | Boolean | `false` | If `true` The camelCase approach is used by error handler. |\n\n## Example\n\n5xx error  `camel_case: false`:\n\n```\n{ \"error\": { \"status_code\": 500,\"code\": \"INTERNAL_SERVER_ERROR\" } }\n```\n\n5xx error  `camel_case: true`:\n\n```\n{ \"error\": { \"statusCode\": 500,\"code\": \"INTERNAL_SERVER_ERROR\" } }\n```\n\n5xx error  `trace: false`:\n\n```\n{ \"error\": { \"status_code\": 500,\"code\": \"INTERNAL_SERVER_ERROR\" } }\n```\n\n5xx error  `with transaction_id`:\n\n```\n{ \"error\": { \"status_code\": 500,\"code\": \"INTERNAL_SERVER_ERROR\", \"transaction_id\": \"7616e2d3-6b90-43ba-8548-f6en12384f39\" } }\n```\n\n5xx error  `trace: true`:\n\n```\n{ \"error\": \n  { \"status_code\": 500,\n    \"code\": \"INTERNAL_SERVER_ERROR\",\n    \"trace\":   \n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)\n    at internal/main/run_main_module.js:17:11 \n    } \n}\n```\n\nThe error object could contain the following fields:\n\n|  Error Key  |  Purpose  |\n| --------- | -------------------------------------------------------------------- |\n| status_code | HTTP status code for response. Default value: `500` (Internal Server Error). |\n| message | Error message. |\n| code | Error code, associated with `status_code`. |\n| trace | Trace including data for dubug such as file, paths. |\n| transaction_id | Unique identifier value that is attached to requests and messages that allow reference to a particular transaction or event chain. |\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardofurnielis%2Fnode-error-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonardofurnielis%2Fnode-error-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardofurnielis%2Fnode-error-handler/lists"}