error-message-utils 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -12,16 +12,10 @@ The `error-message-utils` package simplifies error management in your web applic
12
12
 
13
13
  Install the package:
14
14
  ```bash
15
- $ npm install -S error-message-utils
15
+ npm install -S error-message-utils
16
16
  ```
17
17
 
18
-
19
-
20
-
21
-
22
- </br>
23
-
24
- ## Usage
18
+ ### Examples
25
19
 
26
20
  Encoding an error:
27
21
 
@@ -100,42 +94,47 @@ isEncodedError(encodeError(new Error('Some unknown error.'), 'NASTY_ERROR'));
100
94
  ```
101
95
 
102
96
 
103
- <br/>
104
-
105
- ## Built With
106
-
107
- - TypeScript
108
-
109
-
110
97
 
111
98
 
112
99
  <br/>
113
100
 
114
- ## Running the Tests
101
+ ## Types
115
102
 
116
- ```bash
117
- $ npm run test:unit
103
+ ```typescript
104
+ /**
105
+ * Error Code
106
+ * The code that is inserted when encoding an error. If none is provided or none can be extracted, it defaults to -1.
107
+ */
108
+ type IErrorCode = string | number;
109
+
110
+ /**
111
+ * Decoded Error
112
+ * The object obtained when an error is decoded. Keep in mind that if the error message or the code cannot be extracted for any reason, the default values will be set instead.
113
+ */
114
+ type IDecodedError = {
115
+ message: string,
116
+ code: IErrorCode,
117
+ };
118
118
  ```
119
119
 
120
120
 
121
121
 
122
-
123
-
124
122
  <br/>
125
123
 
126
- ## License
127
-
128
- [MIT](https://choosealicense.com/licenses/mit/)
124
+ ## Built With
129
125
 
126
+ - TypeScript
130
127
 
131
128
 
132
129
 
133
130
 
134
131
  <br/>
135
132
 
136
- ## Acknowledgments
133
+ ## Running the Tests
137
134
 
138
- - ...
135
+ ```bash
136
+ npm run test:unit
137
+ ```
139
138
 
140
139
 
141
140
 
@@ -143,9 +142,9 @@ $ npm run test:unit
143
142
 
144
143
  <br/>
145
144
 
146
- ## @TODOS
145
+ ## License
147
146
 
148
- - [ ] ...
147
+ [MIT](https://choosealicense.com/licenses/mit/)
149
148
 
150
149
 
151
150
 
@@ -157,17 +156,17 @@ $ npm run test:unit
157
156
 
158
157
  Install dependencies:
159
158
  ```bash
160
- $ npm install
159
+ npm install
161
160
  ```
162
161
 
163
162
 
164
163
  Build the library:
165
164
  ```bash
166
- $ npm start
165
+ npm start
167
166
  ```
168
167
 
169
168
 
170
169
  Publish to `npm`:
171
170
  ```bash
172
- $ npm publish
171
+ npm publish
173
172
  ```
package/dist/index.d.ts CHANGED
@@ -26,4 +26,4 @@ declare const decodeError: (error: any) => IDecodedError;
26
26
  * @returns boolean
27
27
  */
28
28
  declare const isEncodedError: (error: any) => boolean;
29
- export { IErrorCode, IDecodedError, extractMessage, encodeError, decodeError, isEncodedError, };
29
+ export { type IErrorCode, type IDecodedError, extractMessage, encodeError, decodeError, isEncodedError, };
@@ -9,8 +9,8 @@ type IErrorCodeWrapper = {
9
9
  };
10
10
  /**
11
11
  * Error Code
12
- * The error's code that is inserted when encoding an error. If none is provided or none can be
13
- * extracted, it defaults to -1.
12
+ * The code that is inserted when encoding an error. If none is provided or none can be extracted,
13
+ * it defaults to -1.
14
14
  */
15
15
  type IErrorCode = string | number;
16
16
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "error-message-utils",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "The error-message-utils package simplifies error management in your web applications and RESTful APIs. It ensures consistent and scalable handling of error messages, saving you time and effort. Moreover, it gives you the ability to assign custom error codes so all possible cases can be handled accordingly.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,14 +37,14 @@
37
37
  },
38
38
  "homepage": "https://github.com/jesusgraterol/error-message-utils#readme",
39
39
  "devDependencies": {
40
- "@types/jest": "^29.5.12",
41
- "@types/node": "^20.14.10",
42
- "@typescript-eslint/eslint-plugin": "^7.16.0",
43
- "@typescript-eslint/parser": "^7.16.0",
40
+ "@types/jest": "^29.5.14",
41
+ "@types/node": "^20.17.9",
42
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
43
+ "@typescript-eslint/parser": "^7.18.0",
44
44
  "eslint-config-airbnb-typescript": "^18.0.0",
45
45
  "jest": "^29.7.0",
46
- "ts-jest": "^29.2.0",
47
- "ts-lib-builder": "^1.0.3",
48
- "typescript": "^5.5.3"
46
+ "ts-jest": "^29.2.5",
47
+ "ts-lib-builder": "^1.0.5",
48
+ "typescript": "^5.7.2"
49
49
  }
50
50
  }