@jsenv/server 12.5.0 → 12.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/server",
3
- "version": "12.5.0",
3
+ "version": "12.5.2",
4
4
  "description": "Write your Node.js server using pure functions",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -239,7 +239,7 @@ export const fetchFileSystem = async (
239
239
  ...(cacheControl ? { "cache-control": cacheControl } : {}),
240
240
  },
241
241
  },
242
- convertFileSystemErrorToResponseProperties(e),
242
+ convertFileSystemErrorToResponseProperties(e) || {},
243
243
  )
244
244
  }
245
245
  }
@@ -6,21 +6,18 @@ export const convertFileSystemErrorToResponseProperties = (error) => {
6
6
  statusText: `EACCES: No permission to read file at ${error.path}`,
7
7
  }
8
8
  }
9
-
10
9
  if (isErrorWithCode(error, "EPERM")) {
11
10
  return {
12
11
  status: 403,
13
12
  statusText: `EPERM: No permission to read file at ${error.path}`,
14
13
  }
15
14
  }
16
-
17
15
  if (isErrorWithCode(error, "ENOENT")) {
18
16
  return {
19
17
  status: 404,
20
18
  statusText: `ENOENT: File not found at ${error.path}`,
21
19
  }
22
20
  }
23
-
24
21
  // file access may be temporarily blocked
25
22
  // (by an antivirus scanning it because recently modified for instance)
26
23
  if (isErrorWithCode(error, "EBUSY")) {
@@ -32,7 +29,6 @@ export const convertFileSystemErrorToResponseProperties = (error) => {
32
29
  },
33
30
  }
34
31
  }
35
-
36
32
  // emfile means there is too many files currently opened
37
33
  if (isErrorWithCode(error, "EMFILE")) {
38
34
  return {
@@ -43,15 +39,13 @@ export const convertFileSystemErrorToResponseProperties = (error) => {
43
39
  },
44
40
  }
45
41
  }
46
-
47
42
  if (isErrorWithCode(error, "EISDIR")) {
48
43
  return {
49
44
  status: 500,
50
45
  statusText: `EISDIR: Unexpected directory operation at ${error.path}`,
51
46
  }
52
47
  }
53
-
54
- return Promise.reject(error)
48
+ return null
55
49
  }
56
50
 
57
51
  const isErrorWithCode = (error, code) => {