@tc-libs/errors 3.14.0 → 4.0.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/README.md +0 -68
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tc-libs/errors",
3
- "version": "3.14.0",
3
+ "version": "4.0.0",
4
4
  "dependencies": {
5
- "@tc-libs/error-interface": "3.14.0",
5
+ "@tc-libs/error-interface": "4.0.0",
6
6
  "@nestjs/common": "^11.0.12",
7
7
  "class-validator": "^0.14.1",
8
8
  "tslib": "^2.8.1"
@@ -11,5 +11,5 @@
11
11
  "type": "commonjs",
12
12
  "main": "./src/index.js",
13
13
  "typings": "./src/index.d.ts",
14
- "types": "./src/index.d.ts"
14
+ "types": "./../packages/errors/src/index.d.ts"
15
15
  }
package/README.md DELETED
@@ -1,68 +0,0 @@
1
- # @tc-libs/errors
2
-
3
- Catalogo di errori custom del monorepo.
4
-
5
- Il package contiene:
6
-
7
- - errori HTTP derivati da `ApiError`
8
- - errori applicativi puri (`AppError`)
9
- - errori di connessione/database/queue
10
- - interfacce di supporto
11
-
12
- ## Struttura
13
-
14
- Le cartelle `api/400`, `api/401`, `api/403`, ecc. espongono classi gia pronte per gli status code piu comuni.
15
-
16
- Esempi di uso reale nel monorepo:
17
-
18
- - `Api422ValidationError`
19
- - `Api401JWTAccessTokenUnauthorizedError`
20
- - `Api403AccessForError`
21
- - `Api404EntityNotFoundError`
22
- - `Api415UnsupportedMediaTypeError`
23
- - `Api408RequestTimeoutError`
24
-
25
- ## Base class
26
-
27
- ### `ApiError`
28
-
29
- Estende `HttpException` e aggiunge:
30
-
31
- - `type`
32
- - `description`
33
- - `data`
34
- - `hasToLogConsole`
35
-
36
- Esempio:
37
-
38
- ```ts
39
- throw new Api404EntityNotFoundError({ entity: 'User' });
40
- ```
41
-
42
- ### `AppError`
43
-
44
- Errore applicativo non HTTP, utile nel bootstrap o in flussi interni:
45
-
46
- ```ts
47
- throw new AppMissingPortError();
48
- ```
49
-
50
- ## Quando usarlo
51
-
52
- Usa questo package quando vuoi:
53
-
54
- - lanciare errori HTTP coerenti con il formato atteso da `@tc-libs/error-handler`
55
- - evitare `throw new HttpException(...)` sparsi nel codice
56
- - standardizzare i message path usati da `@tc-libs/message`
57
-
58
- ## Note operative
59
-
60
- - Gli handler e filtri del monorepo si aspettano eccezioni derivate da `ApiError` per arricchire la risposta.
61
- - Le classi sono numerose: conviene importare solo gli errori che ti servono.
62
-
63
- ## Sviluppo
64
-
65
- ```bash
66
- nx build errors
67
- nx test errors
68
- ```