|
5 | 5 | [](https://www.npmjs.com/package/axios-error-handler-ts) |
6 | 6 | [](https://opensource.org/licenses/MIT) |
7 | 7 |
|
8 | | -A simple and flexible error handler for Axios requests, allowing customizable error messages based on HTTP status codes. It helps manage API error responses by providing clear and customized messages depending on the status code returned by the server. |
9 | | -[](https://badge.fury.io/js/axios-error-handler-ts) |
10 | | - |
11 | 8 | A simple and flexible error handler for Axios requests, allowing customizable error messages based on HTTP status codes. It helps manage API error responses by providing clear and customized messages depending on the status code returned by the server. |
12 | 9 |
|
13 | 10 | ## Installation |
@@ -101,9 +98,7 @@ handleError(error, 403, 'Email or password incorrect.'); |
101 | 98 | #### `errorMessages` (required) |
102 | 99 |
|
103 | 100 | - **Type**: `string | Record<number, string>` |
104 | | -- **Description**: The custom error message(s) for the specified status code(s). If you pass a single string, it will be used for all errors. If passing a `Record<number, string>`, the object keys represent status codes, and values represent corresponding error messages. |
105 | | - |
106 | | -If passing a `Record<number, string>`, must not fill `errorCodesToCheck`, the object keys represent status codes and values represent corresponding error messages. |
| 101 | +- **Description**: The custom error message(s) for the specified status code(s). If you pass a single string, it will be used for all errors. If passing a `Record<number, string>`, the object keys represent status codes, and values represent corresponding error messages. If passing a `Record<number, string>`, must not fill `errorCodesToCheck`, the object keys represent status codes and values represent corresponding error messages. |
107 | 102 |
|
108 | 103 | #### `errorCodeToCheck` (optional) |
109 | 104 |
|
@@ -144,33 +139,9 @@ try { |
144 | 139 | } |
145 | 140 | ``` |
146 | 141 |
|
147 | | -## Development |
148 | | - |
149 | | -To contribute to the project, clone the repository and install dependencies: |
150 | | - |
151 | | -```bash |
152 | | -git clone https://github.com/Jszigeti/axios-error-handler.git |
153 | | -cd axios-error-handler |
154 | | -npm install |
155 | | -``` |
156 | | - |
157 | | -### Running Tests |
158 | | - |
159 | | -The project uses Jest for testing. To run the tests, use the following command: |
160 | | - |
161 | | -```bash |
162 | | -npm test |
163 | | -``` |
164 | | - |
165 | | -### Building |
166 | | - |
167 | | -To compile the TypeScript code into JavaScript, run: |
168 | | - |
169 | | -```bash |
170 | | -npm run build |
171 | | -``` |
| 142 | +## Contributing |
172 | 143 |
|
173 | | -This will generate the compiled code in the `dist` directory. The compiled files are then published to npm instead of the TypeScript source files. |
| 144 | +See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines. |
174 | 145 |
|
175 | 146 | ## License |
176 | 147 |
|
|
0 commit comments