{"_id":"@arunvaradharajalu/common.errors","_rev":"2-35683704a05c30858feee7f59e139d0f","name":"@arunvaradharajalu/common.errors","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@arunvaradharajalu/common.errors","version":"1.0.0","keywords":["errors"],"author":{"name":"Arun Varadharajalu"},"license":"ISC","_id":"@arunvaradharajalu/common.errors@1.0.0","maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"homepage":"https://github.com/arunv11u/common.errors#readme","bugs":{"url":"https://github.com/arunv11u/common.errors/issues"},"dist":{"shasum":"807bb2f8ead3184e4a9f463bd2587d6c69eebb34","tarball":"https://registry.npmjs.org/@arunvaradharajalu/common.errors/-/common.errors-1.0.0.tgz","fileCount":25,"integrity":"sha512-R5p6W6u1gZKeBw7D92jvBWKttAvvIg9fsV7TcPNrbpQD16DT+Hus/xHVmFEbYQ3/yrs4qRRPM8ZziqdehzuWtQ==","signatures":[{"sig":"MEYCIQDS6sw7/s56ySCjWmhYyLNrpZEu4jlke361Ppcr36TMZQIhANhvqSDZ975NzeIpFsBN4ngeT6l+CcVJiN2gk0oU+v1W","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18308},"jest":{"roots":["<rootDir>/test"],"preset":"ts-jest","reporters":["default",["./node_modules/jest-html-reporter",{"pageTitle":"Decorator Test Report"}]],"clearMocks":true,"testEnvironment":"node"},"main":"./build/index.js","types":"./build/index.d.ts","gitHead":"a8a1d90d5094a1cddc8fde435af5b90285ffb3f5","scripts":{"test":"jest --watchAll --verbose --no-cache --detectOpenHandles --env=node --coverage","build":"npm run clean && tsc --project tsconfig.build.json","clean":"rimraf build"},"_npmUser":{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"},"repository":{"url":"git+ssh://git@github.com/arunv11u/common.errors.git","type":"git"},"_npmVersion":"10.2.4","description":"This project contains error classes like database connection error, storage connection error, mail connection error, error handler middleware etc..","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.7","ts-jest":"^29.1.4","@types/jest":"^29.5.12","@types/express":"^4.17.21","jest-html-reporter":"^3.10.2"},"_npmOperationalInternal":{"tmp":"tmp/common.errors_1.0.0_1718402539382_0.39475153160957355","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@arunvaradharajalu/common.errors","version":"1.1.0","keywords":["errors"],"author":{"name":"Arun Varadharajalu"},"license":"ISC","_id":"@arunvaradharajalu/common.errors@1.1.0","maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"homepage":"https://github.com/arunv11u/common.errors#readme","bugs":{"url":"https://github.com/arunv11u/common.errors/issues"},"dist":{"shasum":"6016c4702529bf74f34315bd39b291365e599ed3","tarball":"https://registry.npmjs.org/@arunvaradharajalu/common.errors/-/common.errors-1.1.0.tgz","fileCount":27,"integrity":"sha512-VG6x6eNj1hQqQzmEZIMtz/fTQFzoLYHv1NcjTmGQEMeKMw41ArF9G1ubHNP5SBggOt09xGrX9lwbOBLs2dHLIA==","signatures":[{"sig":"MEYCIQCPqol2/ZH315+nMU3W+WNodg+OlIQorniqujrqN1W6gQIhAJyUSs45s4FGUaj5yX2xDM/wf9HcBd14uswKQSf3Kmhu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21460},"jest":{"roots":["<rootDir>/test"],"preset":"ts-jest","reporters":["default",["./node_modules/jest-html-reporter",{"pageTitle":"Error Test Report"}]],"clearMocks":true,"testEnvironment":"node"},"main":"./build/index.js","types":"./build/index.d.ts","gitHead":"18bf7c52d0cc42d6961aca3a83f92540992f4352","scripts":{"test":"jest --watchAll --verbose --no-cache --detectOpenHandles --env=node --coverage","build":"npm run clean && tsc --project tsconfig.build.json","clean":"rimraf build"},"_npmUser":{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"},"repository":{"url":"git+ssh://git@github.com/arunv11u/common.errors.git","type":"git"},"_npmVersion":"10.2.4","description":"This project contains error classes like database connection error, storage connection error, mail connection error, error handler middleware etc..","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.7","ts-jest":"^29.1.4","@types/jest":"^29.5.12","@types/express":"^4.17.21","jest-html-reporter":"^3.10.2"},"_npmOperationalInternal":{"tmp":"tmp/common.errors_1.1.0_1720161548314_0.745857100585601","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@arunvaradharajalu/common.errors","version":"1.1.1","description":"This project contains error classes like database connection error, storage connection error, mail connection error, error handler middleware etc..","main":"./build/index.js","types":"./build/index.d.ts","scripts":{"clean":"rimraf build","build":"npm run clean && tsc --project tsconfig.build.json","test":"jest --watchAll --verbose --no-cache --detectOpenHandles --env=node --coverage"},"jest":{"preset":"ts-jest","testEnvironment":"node","roots":["<rootDir>/test"],"clearMocks":true,"reporters":["default",["./node_modules/jest-html-reporter",{"pageTitle":"Error Test Report"}]]},"repository":{"type":"git","url":"git+ssh://git@github.com/arunv11u/common.errors.git"},"keywords":["errors"],"author":{"name":"Arun Varadharajalu"},"license":"ISC","bugs":{"url":"https://github.com/arunv11u/common.errors/issues"},"homepage":"https://github.com/arunv11u/common.errors#readme","devDependencies":{"@types/express":"^4.17.21","@types/jest":"^29.5.12","jest-html-reporter":"^3.10.2","rimraf":"^5.0.7","ts-jest":"^29.1.4"},"_id":"@arunvaradharajalu/common.errors@1.1.1","gitHead":"c1199964b66af46f36771789f8a5086ad809984f","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-yyEopUSIDEz/syrxbU9jQY8LJwgBHYblD0lf2d8sXNIAA/auwVPJHHh7gTzFyL4vBuweHkOxIO50fDshJkMDiQ==","shasum":"d78fc9f49e8e30c5848e7a7dbe04acfa3415fb31","tarball":"https://registry.npmjs.org/@arunvaradharajalu/common.errors/-/common.errors-1.1.1.tgz","fileCount":27,"unpackedSize":21494,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHuyUHSj1gn1J7dkeoQ0fIL7uMYXGpKpgroGPJ34UetUAiApWH7v2pEVLUyuIyhBbLQX8Hm80LdPYXNHlcwtJ+774g=="}]},"_npmUser":{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"},"directories":{},"maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common.errors_1.1.1_1730144567164_0.9989643557783037"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-14T22:02:19.257Z","modified":"2024-10-28T19:42:47.489Z","1.0.0":"2024-06-14T22:02:19.647Z","1.1.0":"2024-07-05T06:39:08.480Z","1.1.1":"2024-10-28T19:42:47.311Z"},"bugs":{"url":"https://github.com/arunv11u/common.errors/issues"},"author":{"name":"Arun Varadharajalu"},"license":"ISC","homepage":"https://github.com/arunv11u/common.errors#readme","keywords":["errors"],"repository":{"type":"git","url":"git+ssh://git@github.com/arunv11u/common.errors.git"},"description":"This project contains error classes like database connection error, storage connection error, mail connection error, error handler middleware etc..","maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"readme":"# @arunvaradharajalu/common.errors\n\n[![npm version](https://badge.fury.io/js/%40arunvaradharajalu%2Fcommon.errors.svg)](https://badge.fury.io/js/%40arunvaradharajalu%2Fcommon.errors)\n[![GitHub issues](https://img.shields.io/github/issues/arunv11u/common.errors)](https://github.com/arunv11u/common.errors/issues)\n[![GitHub license](https://img.shields.io/github/license/arunv11u/common.errors)](https://github.com/arunv11u/common.errors/blob/master/LICENSE)\n\nThis npm package provides custom error classes and middleware for handling various types of errors commonly encountered in applications. It includes error classes for database connection errors, storage connection errors, mail connection errors, and a generic error handler middleware for Express applications.\n\n## Installation\n\nInstall the package using npm:\n\n```bash\nnpm install @arunvaradharajalu/common.errors\n```\n\n## Usage\n\n### Error Classes\n\nThe package includes several predefined error classes:\n\n- `DatabaseConnectionError`: Represents errors related to database connections.\n- `StorageConnectionError`: Represents errors related to storage connections.\n- `MailConnectionError`: Represents errors related to mail service connections.\n- `FirebaseCloudMessagingConnectionError`: Represents errors related to firebase cloud messaging connections.\n- `SocketConnectionError`: Represents errors related to socket connections.\n\n## Middleware\n\n### Error Handler Middleware\n\nUse the error handler middleware to handle instances of `CustomError` and send appropriate responses:\n\n```typescript\nimport { errorHandler } from '@arunvaradharajalu/common.errors';\n\n// Example usage with Express\napp.use(errorHandler);\n```\n\n### Example\n\n```typescript\nimport { DatabaseConnectionError } from '@arunvaradharajalu/common.errors';\n\ntry {\n  // Attempt database connection\n} catch (err) {\n  throw new DatabaseConnectionError('Failed to connect to the database');\n}\n```\n\n## Running Tests\n\nTo run the tests, use:\n\n```bash\nnpm test\n```\n\nThe test results will be generated in an HTML report with the title \"Error Test Report\".\n\n## Repository\n\nThe source code is available at: [GitHub Repository](https://github.com/arunv11u/common.errors)\n\n## Issues\n\nIf you encounter any issues, please report them at: [GitHub Issues](https://github.com/arunv11u/common.errors/issues)\n\n## Author\n\nArun Varadharajalu\n\n## License\n\nThis project is licensed under the ISC License.","readmeFilename":"README.md"}