@lvce-editor/shared-process 0.2.1 → 0.2.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": "@lvce-editor/shared-process",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "verror": "^1.10.1",
39
39
  "ws": "^8.8.1",
40
40
  "xdg-basedir": "^5.1.0",
41
- "@lvce-editor/pty-host": "0.2.1",
42
- "@lvce-editor/extension-host": "0.2.1"
41
+ "@lvce-editor/pty-host": "0.2.2",
42
+ "@lvce-editor/extension-host": "0.2.2"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "electron-clipboard-ex": "^1.3.3",
@@ -6,6 +6,7 @@ import * as DirentType from '../DirentType/DirentType.js'
6
6
  import * as Path from '../Path/Path.js'
7
7
  import * as Platform from '../Platform/Platform.js'
8
8
  import * as Trash from '../Trash/Trash.js'
9
+ import * as FileSystemErrorCodes from '../FileSystemErrorCodes/FileSystemErrorCodes.js'
9
10
 
10
11
  export const state = {
11
12
  watcherMap: Object.create(null),
@@ -42,7 +43,7 @@ export const readFile = async (path) => {
42
43
  // console.timeEnd(`read ${path}`)
43
44
  return content
44
45
  } catch (error) {
45
- if (error && error.code === 'ENOENT') {
46
+ if (error && error.code === FileSystemErrorCodes.ENOENT) {
46
47
  throw new VError(`File not found '${path}'`)
47
48
  }
48
49
  throw new VError(error, `Failed to read file "${path}"`)
@@ -55,6 +56,9 @@ export const writeFile = async (path, content) => {
55
56
  // Queue.add(`writeFile/${path}`, () =>
56
57
  await fs.writeFile(path, content)
57
58
  } catch (error) {
59
+ if (error && error.code === FileSystemErrorCodes.ENOENT) {
60
+ throw new VError(`File not found '${path}'`)
61
+ }
58
62
  throw new VError(error, `Failed to write to file "${path}"`)
59
63
  }
60
64
  }
@@ -0,0 +1 @@
1
+ export const ENOENT = 'ENOENT'