33[ ![ npm version] ( https://img.shields.io/npm/v/express-error-toolkit )] ( https://www.npmjs.com/package/express-error-toolkit )
44![ typescript] ( https://badgen.net/badge/icon/typescript?icon=typescript&label )
55[ ![ license] ( https://img.shields.io/npm/l/express-error-toolkit )] ( https://github.com/dev-rashedin/express-error-toolkit/blob/main/LICENSE )
6- [ ![ GitHub stars] ( https://img.shields.io/github/stars/dev-rashedin/express-error-toolkit?style=social )] ( https://github.com/dev-rashedin/express-error-toolkit/stargazers )
76![ minified] ( https://badgen.net/bundlephobia/min/express-error-toolkit )
87![ minified gzip] ( https://badgen.net/bundlephobia/minzip/express-error-toolkit )
98
@@ -59,6 +58,7 @@ yarn add express-error-toolkit
5958pnpm add express-error-toolkit
6059```
6160
61+ > ⚙️ Requires ** Node.js v14 or higher** .
6262> ℹ️ Make sure you have ` express ` installed in your project, as this toolkit is built specifically to enhance Express.js error handling.
6363
6464---
@@ -126,11 +126,28 @@ import { globalErrorHandler } from 'express-error-toolkit';
126126app .use (globalErrorHandler );
127127```
128128
129- In development mode (` NODE_ENV=development ` ), the error stack trace will be included in the response.
129+ By default, it includes stack trace in development (` NODE_ENV=development ` ).
130+
131+
132+ ---
133+
134+ ### 5. ** Set Options Globally (Optional)**
135+
136+ You can configure the toolkit behavior (e.g., hide stack traces even in dev):
137+
138+ ``` ts
139+ import { setToolkitOptions } from ' express-error-toolkit' ;
140+
141+ setToolkitOptions ({
142+ showStack: false ,
143+ });
144+ ```
145+
146+ This overrides the default behavior (based on ` NODE_ENV ` or ` .env ` file).
130147
131148---
132149
133- ### 5 . ** httpError()** : Create generic custom errors
150+ ### 6 . ** httpError()** : Create generic custom errors
134151
135152``` ts
136153import { httpError } from ' express-error-toolkit' ;
@@ -148,7 +165,7 @@ throw new BadRequestError('Generic client error');
148165
149166---
150167
151- ### 6 . ** isCustomAPIError()** : Type guard for checking error type
168+ ### 7 . ** isCustomAPIError()** : Type guard for checking error type
152169
153170``` ts
154171import { isCustomAPIError } from ' express-error-toolkit' ;
@@ -160,7 +177,7 @@ if (isCustomAPIError(err)) {
160177
161178---
162179
163- ### 7 . ** Bonus** : Use status codes directly (re-exported from http-status-toolkit)
180+ ### 8 . ** Bonus** : Use status codes directly (re-exported from http-status-toolkit)
164181
165182``` ts
166183import { StatusCodes , getStatusMessage } from ' express-error-toolkit' ;
0 commit comments