{"id":18762034,"url":"https://github.com/m-ahmedk/custom-error-management","last_synced_at":"2026-05-05T23:31:45.132Z","repository":{"id":65655673,"uuid":"596678010","full_name":"m-ahmedk/custom-error-management","owner":"m-ahmedk","description":"A Node.js project that centralizes error handling in an application by implementing a middleware, responsible for catching all errors thrown by the application and returning a custom error message along with the relevant HTTP status code. Additionally, all errors are logged and stored in a file.","archived":false,"fork":false,"pushed_at":"2023-03-09T14:26:24.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T18:19:32.305Z","etag":null,"topics":["centralized-error-handling","error-management","express","nodejs"],"latest_commit_sha":null,"homepage":"","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/m-ahmedk.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-02T17:48:48.000Z","updated_at":"2023-03-31T23:10:29.000Z","dependencies_parsed_at":"2024-11-07T18:19:01.902Z","dependency_job_id":"8a0e325f-8703-4a62-966e-533bcaec300b","html_url":"https://github.com/m-ahmedk/custom-error-management","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/m-ahmedk/custom-error-management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-ahmedk%2Fcustom-error-management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-ahmedk%2Fcustom-error-management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-ahmedk%2Fcustom-error-management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-ahmedk%2Fcustom-error-management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-ahmedk","download_url":"https://codeload.github.com/m-ahmedk/custom-error-management/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-ahmedk%2Fcustom-error-management/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["centralized-error-handling","error-management","express","nodejs"],"created_at":"2024-11-07T18:18:51.143Z","updated_at":"2026-05-05T23:31:45.112Z","avatar_url":"https://github.com/m-ahmedk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Centralized Error Handling Middleware\nThis project provides a centralized error handling mechanism for a Node/Express application. The error handling is performed using a middleware that receives all errors thrown by the application and returns a custom error message along with a relevant HTTP status code. If any errors go unhandled, a default internal server error (HTTP 500) with a custom message is assigned.\n\nThe errors are also logged using Winston logger and stored in a file. The logs are automatically deleted after 3 days. This system helps to provide consistent, structured, and comprehensive error handling and reporting in the application.\n\nAdditionally, the project opens a swagger documentation (http://localhost:3000/api-docs) which displays all the available requests, their description, and the methods.\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Features\n- Catch all errors thrown by the application\n- Return custom error message along with relevant HTTP status code\n- Assign default internal server error (HTTP 500) with custom message if any errors go unhandled\n- Log all errors using Winston logger\n- Store logs in a file and automatically delete after 3 days\n- Consistent, structured, and comprehensive error handling and reporting\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Getting Started\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Prerequisites\n- Node.js\n- npm\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Installing\nClone the repository:\n\n```\ngit clone https://github.com/m-ahmedk/centralized-error-handling.git\n```\n\nNavigate to the cloned repository:\n\n```\ncd centralized-error-handling\n```\n\nInstall dependencies:\n\n```\nnpm install\n```\n\nRun the project:\n\n```\nnpm start\n``` \n\nOpen the Swagger documentation in your browser at http://localhost:3000/api-docs\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Built With\nNode.js\nExpress\nWinston\nSwagger\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Contributing\nIf you would like to contribute to the project, please reach out to the repository owner.\n\u003cbr /\u003e\u003cbr /\u003e\n\n## License\nThis project is licensed under the MIT License - see the [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/m-ahmedk/custom-error-management/blob/main/LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-ahmedk%2Fcustom-error-management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-ahmedk%2Fcustom-error-management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-ahmedk%2Fcustom-error-management/lists"}