@tramvai/core 4.4.1 → 4.4.4

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.
@@ -88,17 +88,29 @@ class App {
88
88
  }
89
89
  }
90
90
  }
91
+ // About error handling:
92
+ // - can't use LOGGER_TOKEN - circular dependency.
93
+ // - can't use window.logger - remote reporter will be not ready at this moment.
94
+ // - but we still can log app creation errors in inline scripts with global error interceptors.
91
95
  function createApp(options) {
92
96
  let app;
93
97
  try {
94
98
  app = new App(options);
95
99
  }
96
100
  catch (error) {
97
- // Флаг необходим чтобы среди логов найти те которые не дали трамваю стартануть
98
101
  error.appCreationError = true;
99
102
  throw error;
100
103
  }
101
- return app.initialization(typeof window === 'undefined' ? 'server' : 'client').then(() => app);
104
+ return app
105
+ .initialization(typeof window === 'undefined' ? 'server' : 'client')
106
+ .then(() => app)
107
+ .catch((error) => {
108
+ if (error instanceof Error) {
109
+ // eslint-disable-next-line no-param-reassign
110
+ error.appCreationError = true;
111
+ }
112
+ throw error;
113
+ });
102
114
  }
103
115
 
104
116
  export { App, createApp };
package/lib/createApp.js CHANGED
@@ -92,17 +92,29 @@ class App {
92
92
  }
93
93
  }
94
94
  }
95
+ // About error handling:
96
+ // - can't use LOGGER_TOKEN - circular dependency.
97
+ // - can't use window.logger - remote reporter will be not ready at this moment.
98
+ // - but we still can log app creation errors in inline scripts with global error interceptors.
95
99
  function createApp(options) {
96
100
  let app;
97
101
  try {
98
102
  app = new App(options);
99
103
  }
100
104
  catch (error) {
101
- // Флаг необходим чтобы среди логов найти те которые не дали трамваю стартануть
102
105
  error.appCreationError = true;
103
106
  throw error;
104
107
  }
105
- return app.initialization(typeof window === 'undefined' ? 'server' : 'client').then(() => app);
108
+ return app
109
+ .initialization(typeof window === 'undefined' ? 'server' : 'client')
110
+ .then(() => app)
111
+ .catch((error) => {
112
+ if (error instanceof Error) {
113
+ // eslint-disable-next-line no-param-reassign
114
+ error.appCreationError = true;
115
+ }
116
+ throw error;
117
+ });
106
118
  }
107
119
 
108
120
  exports.App = App;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/core",
3
- "version": "4.4.1",
3
+ "version": "4.4.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tinkoff/utils": "^2.1.2",
22
- "@tramvai/tokens-common": "4.4.1",
23
- "@tramvai/tokens-core": "4.4.1",
24
- "@tramvai/types-actions-state-context": "4.4.1",
22
+ "@tramvai/tokens-common": "4.4.4",
23
+ "@tramvai/tokens-core": "4.4.4",
24
+ "@tramvai/types-actions-state-context": "4.4.4",
25
25
  "@tinkoff/dippy": "0.10.2",
26
26
  "node-abort-controller": "^3.0.1",
27
27
  "tslib": "^2.4.0"