@olenbetong/appframe-vite 3.1.14 → 3.1.15

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/lib/proxy.js +13 -0
  2. package/package.json +2 -2
package/lib/proxy.js CHANGED
@@ -54,6 +54,10 @@ export async function login(hostname, username, password) {
54
54
  reject(Error(`Authentication failed: ${response.statusCode} ${response.statusMessage}`));
55
55
  }
56
56
  });
57
+ request.on("error", (error) => {
58
+ console.log(`Authentication request to '${hostname}' failed: ${error.message}`);
59
+ reject(Error(`Authentication failed: ${error.message}`));
60
+ });
57
61
  request.write(data);
58
62
  request.end();
59
63
  });
@@ -90,6 +94,15 @@ export function createAppframeProxy(options) {
90
94
  proxyReqPathResolver: function (req) {
91
95
  return req.originalUrl;
92
96
  },
97
+ proxyErrorHandler: function (error, response, next) {
98
+ switch (error?.code) {
99
+ case "ECONNRESET": {
100
+ return response.status(500).send("Connection reset");
101
+ }
102
+ default:
103
+ next(error);
104
+ }
105
+ }
93
106
  });
94
107
  proxy.setHostname = async (newHostname) => {
95
108
  if (hostname !== newHostname) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-vite",
3
- "version": "3.1.14",
3
+ "version": "3.1.15",
4
4
  "description": "Tools to use and deploy Vite applications to Appframe",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -40,5 +40,5 @@
40
40
  "open": "^9.1.0",
41
41
  "tcp-port-used": "^1.0.2"
42
42
  },
43
- "gitHead": "631b05cc49a5985223fe650edc4e15141d2cdad2"
43
+ "gitHead": "155dfc6d34c83d34ccf729aee9bf83eedefaf8d7"
44
44
  }