satto 1.1.2 → 1.1.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "satto",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "A minimal server-rendered web framework for Node.js",
5
5
  "main": "src/lib/index.js",
6
6
  "bin": {
@@ -29,6 +29,6 @@
29
29
  "express": "^5.2.1"
30
30
  },
31
31
  "overrides": {
32
- "minimatch": "10.2.1"
32
+ "minimatch": "10.2.4"
33
33
  }
34
34
  }
package/src/bin/satto.js CHANGED
@@ -69,7 +69,7 @@ createServer(__dirname, routes);
69
69
  "build": "satto run build"
70
70
  },
71
71
  "overrides": {
72
- "minimatch": "10.2.1"
72
+ "minimatch": "10.2.4"
73
73
  }
74
74
  }`
75
75
  };
package/src/lib/index.js CHANGED
@@ -127,7 +127,6 @@ function createServer(__dirname, routes = [], port = 3000) {
127
127
 
128
128
  res.send(await renderPage(html, params));
129
129
  } catch (err) {
130
- console.error(err);
131
130
  next(err);
132
131
  }
133
132
  });
@@ -140,6 +139,13 @@ function createServer(__dirname, routes = [], port = 3000) {
140
139
 
141
140
  app.use((err, req, res, next) => {
142
141
  console.error(err);
142
+
143
+ const isFetchError = err.message?.includes('fetch failed') || err.code === 'ECONNREFUSED' || err.code === 'ENOTFOUND';
144
+
145
+ if (isFetchError) {
146
+ return res.status(404).send(renderErrorPage(404, "Page Not Found"));
147
+ }
148
+
143
149
  res.status(500).send(renderErrorPage(500, "Internal Server Error"));
144
150
  });
145
151