@pronto-tools-and-more/pronto 6.38.0 → 6.40.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/pronto",
3
- "version": "6.38.0",
3
+ "version": "6.40.0",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
@@ -15,15 +15,15 @@
15
15
  "dependencies": {
16
16
  "@lvce-editor/assert": "^1.3.0",
17
17
  "@lvce-editor/ipc": "^11.0.1",
18
- "@lvce-editor/json-rpc": "^4.1.0",
18
+ "@lvce-editor/json-rpc": "^4.2.0",
19
19
  "@lvce-editor/verror": "^1.4.0",
20
- "@pronto-tools-and-more/file-watcher": "6.38.0",
21
- "@pronto-tools-and-more/files": "6.38.0",
22
- "@pronto-tools-and-more/network-process": "6.38.0",
23
- "@pronto-tools-and-more/sass-compiler": "6.38.0",
24
- "@pronto-tools-and-more/components-renderer": "6.38.0",
25
- "@pronto-tools-and-more/components": "6.38.0",
26
- "@pronto-tools-and-more/schema-process": "6.38.0",
20
+ "@pronto-tools-and-more/file-watcher": "6.40.0",
21
+ "@pronto-tools-and-more/files": "6.40.0",
22
+ "@pronto-tools-and-more/network-process": "6.40.0",
23
+ "@pronto-tools-and-more/sass-compiler": "6.40.0",
24
+ "@pronto-tools-and-more/components-renderer": "6.40.0",
25
+ "@pronto-tools-and-more/components": "6.40.0",
26
+ "@pronto-tools-and-more/schema-process": "6.40.0",
27
27
  "execa": "^9.4.0",
28
28
  "express": "^4.21.1"
29
29
  },
@@ -0,0 +1,19 @@
1
+ import * as IsPrematureCloseError from "../IsPrematureCloseError/IsPrematureCloseError.js";
2
+
3
+ export const handleUnhandledError = (error) => {
4
+ if (IsPrematureCloseError.isPrematureCloseError(error)) {
5
+ console.info("[server] ignoring premature close error");
6
+ return;
7
+ }
8
+ console.error(`[server] unhandled error: ${error}`);
9
+ // Don't exit server
10
+ };
11
+
12
+ export const handleUnhandledRejection = (error) => {
13
+ if (IsPrematureCloseError.isPrematureCloseError(error)) {
14
+ console.info("[server] ignoring premature close error");
15
+ return;
16
+ }
17
+ console.error(`[server] unhandled rejection: ${error}`);
18
+ // Don't exit server
19
+ };
@@ -0,0 +1,3 @@
1
+ export const isPrematureCloseError = (error) => {
2
+ return error && error.code === "ERR_STREAM_PREMATURE_CLOSE";
3
+ };
@@ -1,5 +1,6 @@
1
1
  import * as Config from "../Config/Config.js";
2
2
  import * as CreateServer from "../CreateServer/CreateServer.js";
3
+ import * as ErrorHandling from "../ErrorHandling/ErrorHandling.js";
3
4
  import * as Promises from "../Promises/Promises.js";
4
5
 
5
6
  export const start = async (
@@ -7,6 +8,10 @@ export const start = async (
7
8
  port = 3000,
8
9
  errorColor = Config.errorColor
9
10
  ) => {
11
+ if (process.env.NODE_ENV !== "test") {
12
+ process.on("uncaughtException", ErrorHandling.handleUnhandledError);
13
+ process.on("unhandledRejection", ErrorHandling.handleUnhandledRejection);
14
+ }
10
15
  const server = await CreateServer.createServer(root, errorColor);
11
16
  const { resolve, promise } = Promises.withResolvers();
12
17
  server.listen(port, resolve);