@quanticdigit/web-errors 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +49 -36
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,64 +1,77 @@
1
- # WebErrors
1
+ # @quanticdigit/web-errors
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.2.0.
3
+ Error collection and presentation: level aggregation, a localized dialog in 31 languages, pluggable
4
+ presenter.
4
5
 
5
- ## Code scaffolding
6
+ This is the implementation of `IErrorInfoAppender`, which `@quanticdigit/web-services` declares and
7
+ does not provide. The service layer knows **that** something went wrong; this knows **how to say it**.
6
8
 
7
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
9
+ ## Install
8
10
 
9
11
  ```bash
10
- ng generate component component-name
12
+ npm install @quanticdigit/web-errors @quanticdigit/web-services
11
13
  ```
12
14
 
13
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
15
+ Peer dependencies: `@angular/core`, `devextreme`, `@quanticdigit/web-services`.
14
16
 
15
- ```bash
16
- ng generate --help
17
- ```
17
+ ## Use it
18
18
 
19
- ## Building
19
+ `ErrorCollector` is `providedIn: 'root'`. Hand it to any service call:
20
20
 
21
- To build the library, run:
21
+ ```ts
22
+ export class UserPage {
23
+ private readonly errors = inject(ErrorCollector);
22
24
 
23
- ```bash
24
- ng build web-errors
25
+ load(): void {
26
+ this.users.byId(7, this.errors).subscribe((user) => …);
27
+ }
28
+ }
25
29
  ```
26
30
 
27
- This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
31
+ Errors raised in the same turn are gathered into **one** dialog. Three failing calls produce three
32
+ lines, not three windows the user closes without reading.
28
33
 
29
- ### Publishing the Library
34
+ ## It already speaks your language
30
35
 
31
- Once the project is built, you can publish your library by following these steps:
36
+ The texts ship with the package in the same 31 languages DevExtreme covers, so the dialog does not
37
+ come out in English surrounded by translated components. Nothing to configure.
32
38
 
33
- 1. Navigate to the `dist` directory:
39
+ ## Three levels of customization
34
40
 
35
- ```bash
36
- cd dist/web-errors
37
- ```
41
+ Nothing is mandatory. In order of weight:
38
42
 
39
- 2. Run the `npm publish` command to publish your library to the npm registry:
40
- ```bash
41
- npm publish
42
- ```
43
+ **One text.** Load that key into your own DevExtreme catalogue; it wins over the built-in one, and
44
+ the other seven stay as they are.
43
45
 
44
- ## Running unit tests
46
+ ```ts
47
+ loadMessages({ it: { dialogTitleError: 'Ops' } });
48
+ ```
45
49
 
46
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
50
+ **The window.** Declare `ERROR_PRESENTER` and ours is never even built.
47
51
 
48
- ```bash
49
- ng test
52
+ ```ts
53
+ { provide: ERROR_PRESENTER, useValue: (p) => myDialog(p.title, p.message, p.errors) }
50
54
  ```
51
55
 
52
- ## Running end-to-end tests
53
-
54
- For end-to-end (e2e) testing, run:
56
+ To keep the default and add to it, wrap the exported one:
55
57
 
56
- ```bash
57
- ng e2e
58
+ ```ts
59
+ { provide: ERROR_PRESENTER, useValue: (p) => { telemetry(p); devExtremeDialogPresenter(p); } }
58
60
  ```
59
61
 
60
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
62
+ **Everything.** Implement `IErrorInfoAppender` yourself and this package is not needed.
63
+
64
+ ## A note on messages
65
+
66
+ `IErrorInfoModel.message` carries whatever the server put there. In products that resolve errors
67
+ through a copy catalogue it is a **key**, not a sentence: resolve it before handing it over, or the
68
+ key is what the user reads.
69
+
70
+ ## The family
71
+
72
+ `web-utils`, `web-model`, `web-services`, `web-component` and `web-errors` are released together and
73
+ always share the same version. Install them at the same version.
61
74
 
62
- ## Additional Resources
75
+ ## License
63
76
 
64
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
77
+ Commercial. See `LICENSE.txt` in the package.
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@quanticdigit/web-errors",
3
- "version": "1.0.0",
4
- "description": "Raccolta e presentazione degli errori applicativi: accumulo per livello e dialogo.",
3
+ "version": "1.0.2",
4
+ "description": "Error collection and presentation: level aggregation, a localized dialog in 31 languages, pluggable presenter.",
5
5
  "author": "Quantic Digit S.R.L.",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
7
7
  "homepage": "https://www.quanticdigit.it/",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://gitlab.com/quanticdigit/library.git"
10
+ "url": "git+https://gitlab.com/quanticdigit/library.git"
11
11
  },
12
12
  "sideEffects": false,
13
13
  "peerDependencies": {
14
14
  "@angular/core": "^21.2.0",
15
15
  "devextreme": "^25.1.3",
16
- "@quanticdigit/web-services": "1.0.0"
16
+ "@quanticdigit/web-services": "1.0.2"
17
17
  },
18
18
  "dependencies": {
19
19
  "tslib": "^2.3.0"