error-shield 1.0.0 โ†’ 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 Gopinath Kathirvel
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,119 +1,262 @@
1
- # error-handler
1
+ <div align="center">
2
2
 
3
- A comprehensive error handling utility for Node.js applications. Provides structured error handling, formatting, and Express.js middleware support.
3
+ # ๐Ÿ›ก๏ธ Error Shield
4
4
 
5
- ## Features
5
+ ### Elegant, structured error handling for Node.js & Express.js
6
6
 
7
- - ๐ŸŽฏ **Custom Error Class** - Extendable `AppError` class with status codes and context
8
- - ๐Ÿ“ฆ **Error Formatting** - Consistent error formatting with customizable options
9
- - ๐Ÿ”„ **Async Handler** - Wrapper for async functions to catch errors
10
- - ๐Ÿš€ **Express Middleware** - Ready-to-use Express.js error handler middleware
11
- - ๐Ÿ› ๏ธ **Error Creators** - Pre-built error creators for common HTTP status codes
12
- - ๐Ÿ“ **TypeScript Support** - Full TypeScript definitions included
7
+ [![npm version](https://img.shields.io/npm/v/error-shield?style=for-the-badge&color=cb3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/error-shield)
8
+ [![License](https://img.shields.io/npm/l/error-shield?style=for-the-badge&color=blue)](https://github.com/Gopinathgopi13/error-shield/blob/main/LICENSE)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
10
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D14-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
11
+ [![Downloads](https://img.shields.io/npm/dt/error-shield?style=for-the-badge&color=brightgreen&logo=npm)](https://www.npmjs.com/package/error-shield)
13
12
 
14
- ## Installation
13
+ **Stop writing repetitive error handling code.** Error Shield gives you a battle-tested toolkit โ€”
14
+ custom error classes, async wrappers, Express middleware, and 40+ HTTP error creators โ€” out of the box.
15
+
16
+ [Get Started](#-quick-start) ยท [API Reference](#-api-reference) ยท [Examples](#-usage-examples) ยท [Contributing](#-contributing)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## โœจ Why Error Shield?
23
+
24
+ | Pain Point | How Error Shield Helps |
25
+ | :------------------------------------------------ | :-------------------------------------------------- |
26
+ | โŒ Inconsistent error responses across routes | โœ… Uniform `ErrorDetails` structure everywhere |
27
+ | โŒ Boilerplate `try/catch` in every async handler | โœ… `asyncHandler()` wraps it for you |
28
+ | โŒ Manually setting status codes & messages | โœ… 40+ pre-built `ErrorCreators` with correct codes |
29
+ | โŒ No context attached to errors for debugging | โœ… `AppError` carries structured `context` data |
30
+ | โŒ Missing TypeScript types for errors | โœ… Full type definitions included |
31
+
32
+ ---
33
+
34
+ ## ๐Ÿ“ฆ Installation
15
35
 
16
36
  ```bash
17
- npm install error-handler
37
+ # npm
38
+ npm install error-shield
39
+
40
+ # yarn
41
+ yarn add error-shield
42
+
43
+ # pnpm
44
+ pnpm add error-shield
45
+ ```
46
+
47
+ ---
48
+
49
+ ## โšก Quick Start
50
+
51
+ Get up and running in **under 60 seconds**:
52
+
53
+ ```javascript
54
+ const {
55
+ AppError,
56
+ handleError,
57
+ ErrorCreators,
58
+ expressErrorHandler,
59
+ asyncHandler,
60
+ } = require("error-shield");
61
+
62
+ // 1๏ธโƒฃ Throw meaningful errors
63
+ throw ErrorCreators.notFound("User not found", { userId: 42 });
64
+
65
+ // 2๏ธโƒฃ Handle & format any error
66
+ const details = handleError(new Error("Oops"), { includeStack: true });
67
+
68
+ // 3๏ธโƒฃ Plug into Express with one line
69
+ app.use(expressErrorHandler({ includeTimestamp: true }));
18
70
  ```
19
71
 
20
- ## Usage
72
+ That's it โ€” structured errors, formatted output, and Express integration with zero boilerplate. ๐ŸŽ‰
21
73
 
22
- ### Basic Usage
74
+ ---
75
+
76
+ ## ๐Ÿ“– Table of Contents
77
+
78
+ - [Why Error Shield?](#-why-error-shield)
79
+ - [Installation](#-installation)
80
+ - [Quick Start](#-quick-start)
81
+ - [Usage Examples](#-usage-examples)
82
+ - [Custom Errors with `AppError`](#1%EF%B8%8Fโƒฃ-custom-errors-with-apperror)
83
+ - [Error Creators](#2%EF%B8%8Fโƒฃ-error-creators)
84
+ - [Express.js Middleware](#3%EF%B8%8Fโƒฃ-expressjs-middleware)
85
+ - [Async Handler Wrapper](#4%EF%B8%8Fโƒฃ-async-handler-wrapper)
86
+ - [Custom Logger](#5%EF%B8%8Fโƒฃ-custom-logger)
87
+ - [API Reference](#-api-reference)
88
+ - [Error Creators โ€” Full Reference](#-error-creators--full-reference)
89
+ - [TypeScript Support](#-typescript-support)
90
+ - [Contributing](#-contributing)
91
+ - [License](#-license)
92
+
93
+ ---
94
+
95
+ ## ๐Ÿš€ Usage Examples
96
+
97
+ ### 1๏ธโƒฃ Custom Errors with `AppError`
98
+
99
+ Create rich, structured errors with status codes, error codes, and arbitrary context:
23
100
 
24
101
  ```javascript
25
- const { AppError, handleError, ErrorCreators } = require('error-handler');
102
+ const { AppError, handleError } = require("error-shield");
26
103
 
27
- // Create a custom error
28
- const error = new AppError('Something went wrong', 500, 'CUSTOM_ERROR', {
104
+ const error = new AppError("Something went wrong", 500, "CUSTOM_ERROR", {
29
105
  userId: 123,
30
- action: 'updateProfile'
106
+ action: "updateProfile",
31
107
  });
32
108
 
33
- // Handle and format error
34
109
  const errorDetails = handleError(error, {
35
110
  includeStack: true,
36
- includeTimestamp: true
111
+ includeTimestamp: true,
37
112
  });
38
113
 
39
114
  console.log(errorDetails);
40
115
  ```
41
116
 
42
- ### Using Error Creators
117
+ <details>
118
+ <summary>๐Ÿ“‹ <strong>Example Output</strong></summary>
119
+
120
+ ```json
121
+ {
122
+ "message": "Something went wrong",
123
+ "statusCode": 500,
124
+ "code": "CUSTOM_ERROR",
125
+ "context": {
126
+ "userId": 123,
127
+ "action": "updateProfile"
128
+ },
129
+ "isOperational": true,
130
+ "timestamp": "2026-02-24T10:30:00.000Z",
131
+ "stack": "Error: Something went wrong\n at ..."
132
+ }
133
+ ```
134
+
135
+ </details>
136
+
137
+ ---
138
+
139
+ ### 2๏ธโƒฃ Error Creators
140
+
141
+ Use pre-built error factories for common HTTP errors โ€” no need to memorize status codes:
43
142
 
44
143
  ```javascript
45
- const { ErrorCreators } = require('error-handler');
144
+ const { ErrorCreators } = require("error-shield");
46
145
 
47
- // Bad Request (400)
48
- throw ErrorCreators.badRequest('Invalid input provided', { field: 'email' });
146
+ // ๐Ÿ”ด 400 โ€” Bad Request
147
+ throw ErrorCreators.badRequest("Invalid input provided", { field: "email" });
49
148
 
50
- // Unauthorized (401)
51
- throw ErrorCreators.unauthorized('Authentication required');
149
+ // ๐Ÿ”’ 401 โ€” Unauthorized
150
+ throw ErrorCreators.unauthorized("Authentication required");
52
151
 
53
- // Not Found (404)
54
- throw ErrorCreators.notFound('User not found', { userId: 123 });
152
+ // ๐Ÿ” 404 โ€” Not Found
153
+ throw ErrorCreators.notFound("User not found", { userId: 123 });
55
154
 
56
- // Validation Error (422)
57
- throw ErrorCreators.validationError('Email is required', { field: 'email' });
155
+ // โœ๏ธ 422 โ€” Validation Error
156
+ throw ErrorCreators.validationError("Email is required", { field: "email" });
157
+
158
+ // ๐Ÿšฆ 429 โ€” Too Many Requests
159
+ throw ErrorCreators.tooManyRequests("Rate limit exceeded", { retryAfter: 60 });
160
+
161
+ // ๐Ÿ’ฅ 500 โ€” Internal Server Error
162
+ throw ErrorCreators.internalServerError("Unexpected failure");
58
163
  ```
59
164
 
60
- ### Express.js Middleware
165
+ ---
166
+
167
+ ### 3๏ธโƒฃ Express.js Middleware
168
+
169
+ Plug in a production-ready error handler with a single line:
61
170
 
62
171
  ```javascript
63
- const express = require('express');
64
- const { expressErrorHandler, ErrorCreators } = require('error-handler');
172
+ const express = require("express");
173
+ const {
174
+ expressErrorHandler,
175
+ asyncHandler,
176
+ ErrorCreators,
177
+ } = require("error-shield");
65
178
 
66
179
  const app = express();
67
180
 
68
- // Your routes
69
- app.get('/users/:id', async (req, res, next) => {
70
- const user = await getUserById(req.params.id);
71
- if (!user) {
72
- throw ErrorCreators.notFound('User not found', { userId: req.params.id });
73
- }
74
- res.json(user);
75
- });
181
+ // Your routes โ€” errors are automatically caught & forwarded
182
+ app.get(
183
+ "/users/:id",
184
+ asyncHandler(async (req, res) => {
185
+ const user = await getUserById(req.params.id);
186
+ if (!user) {
187
+ throw ErrorCreators.notFound("User not found", { userId: req.params.id });
188
+ }
189
+ res.json(user);
190
+ }),
191
+ );
192
+
193
+ // โฌ‡๏ธ Error handler middleware (must be last)
194
+ app.use(
195
+ expressErrorHandler({
196
+ includeStack: process.env.NODE_ENV !== "production",
197
+ includeTimestamp: true,
198
+ }),
199
+ );
200
+
201
+ app.listen(3000, () => console.log("๐Ÿš€ Server running on port 3000"));
202
+ ```
76
203
 
77
- // Error handler middleware (must be last)
78
- app.use(expressErrorHandler({
79
- includeStack: process.env.NODE_ENV !== 'production',
80
- includeTimestamp: true
81
- }));
204
+ > **๐Ÿ’ก Tip:** Combine `asyncHandler` with `expressErrorHandler` for completely boilerplate-free async route error handling.
82
205
 
83
- app.listen(3000);
84
- ```
206
+ ---
207
+
208
+ ### 4๏ธโƒฃ Async Handler Wrapper
85
209
 
86
- ### Async Handler Wrapper
210
+ Eliminate `try/catch` blocks in your async route handlers:
87
211
 
88
212
  ```javascript
89
- const { asyncHandler } = require('error-handler');
213
+ const { asyncHandler } = require("error-shield");
214
+
215
+ // โŒ Without asyncHandler
216
+ app.get("/api/data", async (req, res, next) => {
217
+ try {
218
+ const data = await fetchData();
219
+ res.json(data);
220
+ } catch (err) {
221
+ next(err); // easy to forget!
222
+ }
223
+ });
90
224
 
91
- // Wrap async route handlers
92
- app.get('/api/data', asyncHandler(async (req, res) => {
93
- const data = await fetchData();
94
- res.json(data);
95
- }));
225
+ // โœ… With asyncHandler โ€” clean & safe
226
+ app.get(
227
+ "/api/data",
228
+ asyncHandler(async (req, res) => {
229
+ const data = await fetchData();
230
+ res.json(data);
231
+ }),
232
+ );
96
233
  ```
97
234
 
98
- ### Custom Logger
235
+ ---
236
+
237
+ ### 5๏ธโƒฃ Custom Logger
238
+
239
+ Attach your own logging logic โ€” send errors to Sentry, Datadog, or any external service:
99
240
 
100
241
  ```javascript
101
- const { handleError } = require('error-handler');
242
+ const { handleError } = require("error-shield");
102
243
 
103
244
  const errorDetails = handleError(error, {
104
- logger: (errorDetails) => {
105
- // Custom logging logic
106
- console.error('Error occurred:', errorDetails);
107
- // Send to logging service, etc.
108
- }
245
+ logger: (details) => {
246
+ console.error("[ERROR]", details.message);
247
+ // ๐Ÿ“ค Send to your logging service
248
+ Sentry.captureException(details);
249
+ },
109
250
  });
110
251
  ```
111
252
 
112
- ## API Reference
253
+ ---
254
+
255
+ ## ๐Ÿ“š API Reference
113
256
 
114
- ### `AppError`
257
+ ### `AppError` class
115
258
 
116
- Custom error class that extends the native `Error` class.
259
+ > Extends the native `Error` class with structured metadata.
117
260
 
118
261
  ```typescript
119
262
  class AppError extends Error {
@@ -124,78 +267,187 @@ class AppError extends Error {
124
267
  }
125
268
  ```
126
269
 
127
- **Constructor:**
128
- - `message: string` - Error message
129
- - `statusCode: number` - HTTP status code (default: 500)
130
- - `code?: string` - Error code
131
- - `context?: Record<string, any>` - Additional context
270
+ | Parameter | Type | Default | Description |
271
+ | :----------- | :-------------------- | :-----: | :--------------------------- |
272
+ | `message` | `string` | โ€” | Error message |
273
+ | `statusCode` | `number` | `500` | HTTP status code |
274
+ | `code` | `string` | โ€” | Machine-readable error code |
275
+ | `context` | `Record<string, any>` | โ€” | Additional debugging context |
276
+
277
+ ---
132
278
 
133
279
  ### `formatError(error, options?)`
134
280
 
135
- Formats an error into a structured object.
281
+ > Formats any error into a consistent `ErrorDetails` object.
136
282
 
137
- **Parameters:**
138
- - `error: Error | AppError` - The error to format
139
- - `options: ErrorHandlerOptions` - Formatting options
283
+ | Parameter | Type | Description |
284
+ | :-------- | :-------------------- | :------------------ |
285
+ | `error` | `Error \| AppError` | The error to format |
286
+ | `options` | `ErrorHandlerOptions` | Formatting options |
140
287
 
141
288
  **Returns:** `ErrorDetails`
142
289
 
290
+ ---
291
+
143
292
  ### `handleError(error, options?)`
144
293
 
145
- Handles errors with optional logging and formatting.
294
+ > Handles errors with optional logging and formatting.
146
295
 
147
- **Parameters:**
148
- - `error: Error | AppError` - The error to handle
149
- - `options: ErrorHandlerOptions` - Handler options
296
+ | Parameter | Type | Description |
297
+ | :-------- | :-------------------- | :---------------------------------------------------------------------- |
298
+ | `error` | `Error \| AppError` | The error to handle |
299
+ | `options` | `ErrorHandlerOptions` | Handler options (includes `logger`, `includeStack`, `includeTimestamp`) |
150
300
 
151
301
  **Returns:** `ErrorDetails`
152
302
 
303
+ ---
304
+
153
305
  ### `asyncHandler(fn)`
154
306
 
155
- Wraps an async function to catch errors.
307
+ > Wraps an async Express route handler to automatically catch rejected promises.
156
308
 
157
- **Parameters:**
158
- - `fn: Function` - Async function to wrap
309
+ | Parameter | Type | Description |
310
+ | :-------- | :--------------------------------- | :--------------------------- |
311
+ | `fn` | `(req, res, next) => Promise<any>` | Async route handler function |
159
312
 
160
- **Returns:** Wrapped function
313
+ **Returns:** Wrapped Express middleware function
314
+
315
+ ---
161
316
 
162
317
  ### `expressErrorHandler(options?)`
163
318
 
164
- Creates an Express.js error handler middleware.
319
+ > Creates an Express.js error-handling middleware.
165
320
 
166
- **Parameters:**
167
- - `options: ErrorHandlerOptions` - Handler options
321
+ | Parameter | Type | Description |
322
+ | :-------- | :-------------------- | :-------------- |
323
+ | `options` | `ErrorHandlerOptions` | Handler options |
168
324
 
169
- **Returns:** Express middleware function
325
+ **Returns:** Express error middleware `(err, req, res, next) => void`
170
326
 
171
- ### `ErrorCreators`
327
+ ---
172
328
 
173
- Pre-built error creators for common HTTP status codes:
329
+ ## ๐Ÿ—‚๏ธ Error Creators โ€” Full Reference
174
330
 
175
- - `badRequest(message, context?)` - 400
176
- - `unauthorized(message?, context?)` - 401
177
- - `forbidden(message?, context?)` - 403
178
- - `notFound(message?, context?)` - 404
179
- - `conflict(message, context?)` - 409
180
- - `validationError(message, context?)` - 422
181
- - `internalServerError(message?, context?)` - 500
182
- - `serviceUnavailable(message?, context?)` - 503
331
+ Pre-built factory methods for **all standard HTTP error codes**. Every method returns an `AppError` instance.
183
332
 
184
- ## TypeScript Support
333
+ ```javascript
334
+ // Signature for all creators:
335
+ ErrorCreators.methodName(message?, context?)
336
+ // โ†’ Returns: AppError
337
+ ```
185
338
 
186
- This package includes full TypeScript definitions:
339
+ <details>
340
+ <summary>๐ŸŸ  <strong>4xx Client Errors</strong> <em>(click to expand)</em></summary>
341
+
342
+ | Method | Code | Default Message |
343
+ | :------------------------------------------------ | :---: | :------------------------------ |
344
+ | `badRequest(message, context?)` | `400` | _(required)_ |
345
+ | `unauthorized(message?, context?)` | `401` | Unauthorized |
346
+ | `paymentRequired(message?, context?)` | `402` | Payment Required |
347
+ | `forbidden(message?, context?)` | `403` | Forbidden |
348
+ | `notFound(message?, context?)` | `404` | Not Found |
349
+ | `methodNotAllowed(message?, context?)` | `405` | Method Not Allowed |
350
+ | `notAcceptable(message?, context?)` | `406` | Not Acceptable |
351
+ | `proxyAuthRequired(message?, context?)` | `407` | Proxy Authentication Required |
352
+ | `requestTimeout(message?, context?)` | `408` | Request Timeout |
353
+ | `conflict(message, context?)` | `409` | _(required)_ |
354
+ | `gone(message?, context?)` | `410` | Gone |
355
+ | `lengthRequired(message?, context?)` | `411` | Length Required |
356
+ | `preconditionFailed(message?, context?)` | `412` | Precondition Failed |
357
+ | `payloadTooLarge(message?, context?)` | `413` | Payload Too Large |
358
+ | `uriTooLong(message?, context?)` | `414` | URI Too Long |
359
+ | `unsupportedMediaType(message?, context?)` | `415` | Unsupported Media Type |
360
+ | `rangeNotSatisfiable(message?, context?)` | `416` | Range Not Satisfiable |
361
+ | `expectationFailed(message?, context?)` | `417` | Expectation Failed |
362
+ | `imATeapot(message?, context?)` | `418` | I'm a Teapot |
363
+ | `misdirectedRequest(message?, context?)` | `421` | Misdirected Request |
364
+ | `unprocessableEntity(message?, context?)` | `422` | Unprocessable Entity |
365
+ | `validationError(message, context?)` | `422` | _(required)_ |
366
+ | `locked(message?, context?)` | `423` | Locked |
367
+ | `failedDependency(message?, context?)` | `424` | Failed Dependency |
368
+ | `tooEarly(message?, context?)` | `425` | Too Early |
369
+ | `upgradeRequired(message?, context?)` | `426` | Upgrade Required |
370
+ | `preconditionRequired(message?, context?)` | `428` | Precondition Required |
371
+ | `tooManyRequests(message?, context?)` | `429` | Too Many Requests |
372
+ | `requestHeaderFieldsTooLarge(message?, context?)` | `431` | Request Header Fields Too Large |
373
+ | `unavailableForLegalReasons(message?, context?)` | `451` | Unavailable For Legal Reasons |
374
+
375
+ </details>
376
+
377
+ <details>
378
+ <summary>๐Ÿ”ด <strong>5xx Server Errors</strong> <em>(click to expand)</em></summary>
379
+
380
+ | Method | Code | Default Message |
381
+ | :-------------------------------------------------- | :---: | :------------------------------ |
382
+ | `internalServerError(message?, context?)` | `500` | Internal Server Error |
383
+ | `notImplemented(message?, context?)` | `501` | Not Implemented |
384
+ | `badGateway(message?, context?)` | `502` | Bad Gateway |
385
+ | `serviceUnavailable(message?, context?)` | `503` | Service Unavailable |
386
+ | `gatewayTimeout(message?, context?)` | `504` | Gateway Timeout |
387
+ | `httpVersionNotSupported(message?, context?)` | `505` | HTTP Version Not Supported |
388
+ | `variantAlsoNegotiates(message?, context?)` | `506` | Variant Also Negotiates |
389
+ | `insufficientStorage(message?, context?)` | `507` | Insufficient Storage |
390
+ | `loopDetected(message?, context?)` | `508` | Loop Detected |
391
+ | `bandwidthLimitExceeded(message?, context?)` | `509` | Bandwidth Limit Exceeded |
392
+ | `notExtended(message?, context?)` | `510` | Not Extended |
393
+ | `networkAuthenticationRequired(message?, context?)` | `511` | Network Authentication Required |
394
+ | `networkConnectTimeout(message?, context?)` | `599` | Network Connect Timeout |
395
+
396
+ </details>
397
+
398
+ ---
399
+
400
+ ## ๐ŸŸฆ TypeScript Support
401
+
402
+ Error Shield ships with **full TypeScript declarations** โ€” zero extra config needed.
187
403
 
188
404
  ```typescript
189
- import { AppError, ErrorCreators, handleError } from 'error-handler';
405
+ import {
406
+ AppError,
407
+ ErrorCreators,
408
+ handleError,
409
+ asyncHandler,
410
+ expressErrorHandler,
411
+ type ErrorDetails,
412
+ type ErrorHandlerOptions,
413
+ } from "error-shield";
414
+
415
+ // Fully typed error creation
416
+ const error: AppError = ErrorCreators.notFound("User not found", {
417
+ userId: 42,
418
+ });
190
419
 
191
- const error: AppError = ErrorCreators.notFound('User not found');
192
- const details = handleError(error);
420
+ // Typed error details
421
+ const details: ErrorDetails = handleError(error, {
422
+ includeStack: true,
423
+ includeTimestamp: true,
424
+ });
193
425
  ```
194
426
 
195
- ## License
427
+ ---
428
+
429
+ ## ๐Ÿค Contributing
430
+
431
+ Contributions, issues, and feature requests are welcome!
432
+
433
+ 1. **Fork** the repository
434
+ 2. **Create** your feature branch โ€” `git checkout -b feature/amazing-feature`
435
+ 3. **Commit** your changes โ€” `git commit -m "feat: add amazing feature"`
436
+ 4. **Push** to the branch โ€” `git push origin feature/amazing-feature`
437
+ 5. **Open** a Pull Request
438
+
439
+ ---
440
+
441
+ ## ๐Ÿ“„ License
442
+
443
+ This project is licensed under the [ISC License](https://opensource.org/licenses/ISC).
444
+
445
+ ---
446
+
447
+ <div align="center">
196
448
 
197
- ISC
449
+ Made with โค๏ธ by **[Gopinath Kathirvel](https://github.com/Gopinathgopi13)**
198
450
 
199
- ## Author
451
+ โญ **If you found this useful, give it a star on [GitHub](https://github.com/Gopinathgopi13/error-shield)!** โญ
200
452
 
201
- Gopinath Kathirvel
453
+ </div>
package/dist/index.d.ts CHANGED
@@ -54,12 +54,47 @@ export declare function createErrorResponse(message: string, statusCode?: number
54
54
  export declare const ErrorCreators: {
55
55
  badRequest: (message: string, context?: Record<string, any>) => AppError;
56
56
  unauthorized: (message?: string, context?: Record<string, any>) => AppError;
57
+ paymentRequired: (message?: string, context?: Record<string, any>) => AppError;
57
58
  forbidden: (message?: string, context?: Record<string, any>) => AppError;
58
59
  notFound: (message?: string, context?: Record<string, any>) => AppError;
60
+ methodNotAllowed: (message?: string, context?: Record<string, any>) => AppError;
61
+ notAcceptable: (message?: string, context?: Record<string, any>) => AppError;
62
+ proxyAuthRequired: (message?: string, context?: Record<string, any>) => AppError;
63
+ requestTimeout: (message?: string, context?: Record<string, any>) => AppError;
59
64
  conflict: (message: string, context?: Record<string, any>) => AppError;
65
+ gone: (message?: string, context?: Record<string, any>) => AppError;
66
+ lengthRequired: (message?: string, context?: Record<string, any>) => AppError;
67
+ preconditionFailed: (message?: string, context?: Record<string, any>) => AppError;
68
+ payloadTooLarge: (message?: string, context?: Record<string, any>) => AppError;
69
+ uriTooLong: (message?: string, context?: Record<string, any>) => AppError;
70
+ unsupportedMediaType: (message?: string, context?: Record<string, any>) => AppError;
71
+ rangeNotSatisfiable: (message?: string, context?: Record<string, any>) => AppError;
72
+ expectationFailed: (message?: string, context?: Record<string, any>) => AppError;
73
+ imATeapot: (message?: string, context?: Record<string, any>) => AppError;
74
+ misdirectedRequest: (message?: string, context?: Record<string, any>) => AppError;
75
+ unprocessableEntity: (message?: string, context?: Record<string, any>) => AppError;
60
76
  validationError: (message: string, context?: Record<string, any>) => AppError;
77
+ locked: (message?: string, context?: Record<string, any>) => AppError;
78
+ failedDependency: (message?: string, context?: Record<string, any>) => AppError;
79
+ tooEarly: (message?: string, context?: Record<string, any>) => AppError;
80
+ upgradeRequired: (message?: string, context?: Record<string, any>) => AppError;
81
+ preconditionRequired: (message?: string, context?: Record<string, any>) => AppError;
82
+ tooManyRequests: (message?: string, context?: Record<string, any>) => AppError;
83
+ requestHeaderFieldsTooLarge: (message?: string, context?: Record<string, any>) => AppError;
84
+ unavailableForLegalReasons: (message?: string, context?: Record<string, any>) => AppError;
61
85
  internalServerError: (message?: string, context?: Record<string, any>) => AppError;
86
+ notImplemented: (message?: string, context?: Record<string, any>) => AppError;
87
+ badGateway: (message?: string, context?: Record<string, any>) => AppError;
62
88
  serviceUnavailable: (message?: string, context?: Record<string, any>) => AppError;
89
+ gatewayTimeout: (message?: string, context?: Record<string, any>) => AppError;
90
+ httpVersionNotSupported: (message?: string, context?: Record<string, any>) => AppError;
91
+ variantAlsoNegotiates: (message?: string, context?: Record<string, any>) => AppError;
92
+ insufficientStorage: (message?: string, context?: Record<string, any>) => AppError;
93
+ loopDetected: (message?: string, context?: Record<string, any>) => AppError;
94
+ bandwidthLimitExceeded: (message?: string, context?: Record<string, any>) => AppError;
95
+ notExtended: (message?: string, context?: Record<string, any>) => AppError;
96
+ networkAuthenticationRequired: (message?: string, context?: Record<string, any>) => AppError;
97
+ networkConnectTimeout: (message?: string, context?: Record<string, any>) => AppError;
63
98
  };
64
99
  declare const _default: {
65
100
  AppError: typeof AppError;
@@ -71,12 +106,47 @@ declare const _default: {
71
106
  ErrorCreators: {
72
107
  badRequest: (message: string, context?: Record<string, any>) => AppError;
73
108
  unauthorized: (message?: string, context?: Record<string, any>) => AppError;
109
+ paymentRequired: (message?: string, context?: Record<string, any>) => AppError;
74
110
  forbidden: (message?: string, context?: Record<string, any>) => AppError;
75
111
  notFound: (message?: string, context?: Record<string, any>) => AppError;
112
+ methodNotAllowed: (message?: string, context?: Record<string, any>) => AppError;
113
+ notAcceptable: (message?: string, context?: Record<string, any>) => AppError;
114
+ proxyAuthRequired: (message?: string, context?: Record<string, any>) => AppError;
115
+ requestTimeout: (message?: string, context?: Record<string, any>) => AppError;
76
116
  conflict: (message: string, context?: Record<string, any>) => AppError;
117
+ gone: (message?: string, context?: Record<string, any>) => AppError;
118
+ lengthRequired: (message?: string, context?: Record<string, any>) => AppError;
119
+ preconditionFailed: (message?: string, context?: Record<string, any>) => AppError;
120
+ payloadTooLarge: (message?: string, context?: Record<string, any>) => AppError;
121
+ uriTooLong: (message?: string, context?: Record<string, any>) => AppError;
122
+ unsupportedMediaType: (message?: string, context?: Record<string, any>) => AppError;
123
+ rangeNotSatisfiable: (message?: string, context?: Record<string, any>) => AppError;
124
+ expectationFailed: (message?: string, context?: Record<string, any>) => AppError;
125
+ imATeapot: (message?: string, context?: Record<string, any>) => AppError;
126
+ misdirectedRequest: (message?: string, context?: Record<string, any>) => AppError;
127
+ unprocessableEntity: (message?: string, context?: Record<string, any>) => AppError;
77
128
  validationError: (message: string, context?: Record<string, any>) => AppError;
129
+ locked: (message?: string, context?: Record<string, any>) => AppError;
130
+ failedDependency: (message?: string, context?: Record<string, any>) => AppError;
131
+ tooEarly: (message?: string, context?: Record<string, any>) => AppError;
132
+ upgradeRequired: (message?: string, context?: Record<string, any>) => AppError;
133
+ preconditionRequired: (message?: string, context?: Record<string, any>) => AppError;
134
+ tooManyRequests: (message?: string, context?: Record<string, any>) => AppError;
135
+ requestHeaderFieldsTooLarge: (message?: string, context?: Record<string, any>) => AppError;
136
+ unavailableForLegalReasons: (message?: string, context?: Record<string, any>) => AppError;
78
137
  internalServerError: (message?: string, context?: Record<string, any>) => AppError;
138
+ notImplemented: (message?: string, context?: Record<string, any>) => AppError;
139
+ badGateway: (message?: string, context?: Record<string, any>) => AppError;
79
140
  serviceUnavailable: (message?: string, context?: Record<string, any>) => AppError;
141
+ gatewayTimeout: (message?: string, context?: Record<string, any>) => AppError;
142
+ httpVersionNotSupported: (message?: string, context?: Record<string, any>) => AppError;
143
+ variantAlsoNegotiates: (message?: string, context?: Record<string, any>) => AppError;
144
+ insufficientStorage: (message?: string, context?: Record<string, any>) => AppError;
145
+ loopDetected: (message?: string, context?: Record<string, any>) => AppError;
146
+ bandwidthLimitExceeded: (message?: string, context?: Record<string, any>) => AppError;
147
+ notExtended: (message?: string, context?: Record<string, any>) => AppError;
148
+ networkAuthenticationRequired: (message?: string, context?: Record<string, any>) => AppError;
149
+ networkConnectTimeout: (message?: string, context?: Record<string, any>) => AppError;
80
150
  };
81
151
  };
82
152
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAC1B,IAAI,CAAC,EAAE,MAAM,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CAAC,MAAM,EAAE,GAAG,CAAC;kDAGpC,MAAM,YAAgD,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;0CAGjF,MAAM,YAAwC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;AAKpG,wBAQE"}
package/dist/index.js CHANGED
@@ -101,14 +101,51 @@ function createErrorResponse(message, statusCode = 500, code, context) {
101
101
  * Common error creators
102
102
  */
103
103
  exports.ErrorCreators = {
104
+ // 4xx Client Errors
104
105
  badRequest: (message, context) => new AppError(message, 400, 'BAD_REQUEST', context),
105
106
  unauthorized: (message = 'Unauthorized', context) => new AppError(message, 401, 'UNAUTHORIZED', context),
107
+ paymentRequired: (message = 'Payment Required', context) => new AppError(message, 402, 'PAYMENT_REQUIRED', context),
106
108
  forbidden: (message = 'Forbidden', context) => new AppError(message, 403, 'FORBIDDEN', context),
107
109
  notFound: (message = 'Not Found', context) => new AppError(message, 404, 'NOT_FOUND', context),
110
+ methodNotAllowed: (message = 'Method Not Allowed', context) => new AppError(message, 405, 'METHOD_NOT_ALLOWED', context),
111
+ notAcceptable: (message = 'Not Acceptable', context) => new AppError(message, 406, 'NOT_ACCEPTABLE', context),
112
+ proxyAuthRequired: (message = 'Proxy Authentication Required', context) => new AppError(message, 407, 'PROXY_AUTH_REQUIRED', context),
113
+ requestTimeout: (message = 'Request Timeout', context) => new AppError(message, 408, 'REQUEST_TIMEOUT', context),
108
114
  conflict: (message, context) => new AppError(message, 409, 'CONFLICT', context),
115
+ gone: (message = 'Gone', context) => new AppError(message, 410, 'GONE', context),
116
+ lengthRequired: (message = 'Length Required', context) => new AppError(message, 411, 'LENGTH_REQUIRED', context),
117
+ preconditionFailed: (message = 'Precondition Failed', context) => new AppError(message, 412, 'PRECONDITION_FAILED', context),
118
+ payloadTooLarge: (message = 'Payload Too Large', context) => new AppError(message, 413, 'PAYLOAD_TOO_LARGE', context),
119
+ uriTooLong: (message = 'URI Too Long', context) => new AppError(message, 414, 'URI_TOO_LONG', context),
120
+ unsupportedMediaType: (message = 'Unsupported Media Type', context) => new AppError(message, 415, 'UNSUPPORTED_MEDIA_TYPE', context),
121
+ rangeNotSatisfiable: (message = 'Range Not Satisfiable', context) => new AppError(message, 416, 'RANGE_NOT_SATISFIABLE', context),
122
+ expectationFailed: (message = 'Expectation Failed', context) => new AppError(message, 417, 'EXPECTATION_FAILED', context),
123
+ imATeapot: (message = "I'm a Teapot", context) => new AppError(message, 418, 'IM_A_TEAPOT', context),
124
+ misdirectedRequest: (message = 'Misdirected Request', context) => new AppError(message, 421, 'MISDIRECTED_REQUEST', context),
125
+ unprocessableEntity: (message = 'Unprocessable Entity', context) => new AppError(message, 422, 'UNPROCESSABLE_ENTITY', context),
109
126
  validationError: (message, context) => new AppError(message, 422, 'VALIDATION_ERROR', context),
127
+ locked: (message = 'Locked', context) => new AppError(message, 423, 'LOCKED', context),
128
+ failedDependency: (message = 'Failed Dependency', context) => new AppError(message, 424, 'FAILED_DEPENDENCY', context),
129
+ tooEarly: (message = 'Too Early', context) => new AppError(message, 425, 'TOO_EARLY', context),
130
+ upgradeRequired: (message = 'Upgrade Required', context) => new AppError(message, 426, 'UPGRADE_REQUIRED', context),
131
+ preconditionRequired: (message = 'Precondition Required', context) => new AppError(message, 428, 'PRECONDITION_REQUIRED', context),
132
+ tooManyRequests: (message = 'Too Many Requests', context) => new AppError(message, 429, 'TOO_MANY_REQUESTS', context),
133
+ requestHeaderFieldsTooLarge: (message = 'Request Header Fields Too Large', context) => new AppError(message, 431, 'REQUEST_HEADER_FIELDS_TOO_LARGE', context),
134
+ unavailableForLegalReasons: (message = 'Unavailable For Legal Reasons', context) => new AppError(message, 451, 'UNAVAILABLE_FOR_LEGAL_REASONS', context),
135
+ // 5xx Server Errors
110
136
  internalServerError: (message = 'Internal Server Error', context) => new AppError(message, 500, 'INTERNAL_SERVER_ERROR', context),
137
+ notImplemented: (message = 'Not Implemented', context) => new AppError(message, 501, 'NOT_IMPLEMENTED', context),
138
+ badGateway: (message = 'Bad Gateway', context) => new AppError(message, 502, 'BAD_GATEWAY', context),
111
139
  serviceUnavailable: (message = 'Service Unavailable', context) => new AppError(message, 503, 'SERVICE_UNAVAILABLE', context),
140
+ gatewayTimeout: (message = 'Gateway Timeout', context) => new AppError(message, 504, 'GATEWAY_TIMEOUT', context),
141
+ httpVersionNotSupported: (message = 'HTTP Version Not Supported', context) => new AppError(message, 505, 'HTTP_VERSION_NOT_SUPPORTED', context),
142
+ variantAlsoNegotiates: (message = 'Variant Also Negotiates', context) => new AppError(message, 506, 'VARIANT_ALSO_NEGOTIATES', context),
143
+ insufficientStorage: (message = 'Insufficient Storage', context) => new AppError(message, 507, 'INSUFFICIENT_STORAGE', context),
144
+ loopDetected: (message = 'Loop Detected', context) => new AppError(message, 508, 'LOOP_DETECTED', context),
145
+ bandwidthLimitExceeded: (message = 'Bandwidth Limit Exceeded', context) => new AppError(message, 509, 'BANDWIDTH_LIMIT_EXCEEDED', context),
146
+ notExtended: (message = 'Not Extended', context) => new AppError(message, 510, 'NOT_EXTENDED', context),
147
+ networkAuthenticationRequired: (message = 'Network Authentication Required', context) => new AppError(message, 511, 'NETWORK_AUTHENTICATION_REQUIRED', context),
148
+ networkConnectTimeout: (message = 'Network Connect Timeout', context) => new AppError(message, 599, 'NETWORK_CONNECT_TIMEOUT', context),
112
149
  };
113
150
  // Default export
114
151
  exports.default = {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAiDH,kCA0BC;AAKD,kCAWC;AAKD,oCAQC;AAKD,kDA4BC;AAKD,kDAOC;AAlID;;GAEG;AACH,MAAa,QAAS,SAAQ,KAAK;IAMjC,YACE,OAAe,EACf,aAAqB,GAAG,EACxB,IAAa,EACb,OAA6B;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC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yB,EAAE,OAA6B,EAAE,EAAE,CACpG,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,yBAAyB,EAAE,OAAO,CAAC;IAEhE,mBAAmB,EAAE,CAAC,UAAkB,sBAAsB,EAAE,OAA6B,EAAE,EAAE,CAC/F,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,sBAAsB,EAAE,OAAO,CAAC;IAE7D,YAAY,EAAE,CAAC,UAAkB,eAAe,EAAE,OAA6B,EAAE,EAAE,CACjF,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC;IAEtD,sBAAsB,EAAE,CAAC,UAAkB,0BAA0B,EAAE,OAA6B,EAAE,EAAE,CACtG,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,0BAA0B,EAAE,OAAO,CAAC;IAEjE,WAAW,EAAE,CAAC,UAAkB,cAAc,EAAE,OAA6B,EAAE,EAAE,CAC/E,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC;IAErD,6BAA6B,EAAE,CAAC,UAAkB,iCAAiC,EAAE,OAA6B,EAAE,EAAE,CACpH,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,iCAAiC,EAAE,OAAO,CAAC;IAExE,qBAAqB,EAAE,CAAC,UAAkB,yBAAyB,EAAE,OAA6B,EAAE,EAAE,CACpG,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,yBAAyB,EAAE,OAAO,CAAC;CACjE,CAAC;AAEF,iBAAiB;AACjB,kBAAe;IACb,QAAQ;IACR,WAAW;IACX,WAAW;IACX,YAAY;IACZ,mBAAmB;IACnB,mBAAmB;IACnB,aAAa,EAAb,qBAAa;CACd,CAAC"}
package/package.json CHANGED
@@ -1,39 +1,43 @@
1
1
  {
2
2
  "name": "error-shield",
3
- "version": "1.0.0",
4
- "description": "A comprehensive error handling utility for Node.js applications with Express.js middleware support",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist",
9
- "README.md"
10
- ],
11
- "scripts": {
12
- "build": "tsc",
13
- "prepublishOnly": "npm run build",
14
- "test": "echo \"Error: no test specified\" && exit 1"
15
- },
3
+ "version": "1.2.0",
4
+ "description": "Comprehensive error handling utility for Node.js & Express.js โ€” custom error classes, async handler wrapper, Express middleware, HTTP error creators, and TypeScript support.",
16
5
  "keywords": [
17
- "error",
18
- "error-handler",
19
6
  "error-handling",
20
- "express",
21
- "middleware",
22
- "typescript",
7
+ "error-handler",
8
+ "express-middleware",
9
+ "express-error-handler",
23
10
  "nodejs",
24
- "exception",
25
- "error-management"
11
+ "node-error",
12
+ "async-error-handler",
13
+ "custom-error",
14
+ "http-errors",
15
+ "error-middleware",
16
+ "typescript",
17
+ "error-class",
18
+ "api-errors",
19
+ "rest-api",
20
+ "error-formatting",
21
+ "error-logging",
22
+ "operational-errors",
23
+ "status-codes",
24
+ "express",
25
+ "error-creators",
26
+ "validation-error",
27
+ "app-error",
28
+ "error-utility",
29
+ "structured-errors"
26
30
  ],
31
+ "homepage": "https://github.com/Gopinathgopi13/error-shield",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/Gopinathgopi13/error-shield"
35
+ },
27
36
  "author": "Gopinath Kathirvel",
28
37
  "license": "ISC",
38
+ "main": "index.js",
39
+ "types": "index.d.ts",
29
40
  "engines": {
30
41
  "node": ">=14.0.0"
31
- },
32
- "devDependencies": {
33
- "typescript": "^5.0.0"
34
- },
35
- "repository": {
36
- "type": "git",
37
- "url": ""
38
42
  }
39
43
  }