diff options
author | eric thul <thul.eric@gmail.com> | 2016-11-05 14:01:18 -0400 |
---|---|---|
committer | eric thul <thul.eric@gmail.com> | 2016-11-05 14:01:18 -0400 |
commit | 4b99e432d63e7a0ce8ad8d2184232417853bfd2b (patch) | |
tree | 8b0cf5796e152f2b76753de40576ca193933f004 /src/PscIde.js | |
parent | 2cca7e91062917d3239f179770133175350af7cc (diff) | |
download | purs-loader-4b99e432d63e7a0ce8ad8d2184232417853bfd2b.tar.gz purs-loader-4b99e432d63e7a0ce8ad8d2184232417853bfd2b.tar.zst purs-loader-4b99e432d63e7a0ce8ad8d2184232417853bfd2b.zip |
Wrapping reject values in Error objects
Diffstat (limited to 'src/PscIde.js')
-rw-r--r-- | src/PscIde.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/PscIde.js b/src/PscIde.js index 9d6c1ff..c9d0cfa 100644 --- a/src/PscIde.js +++ b/src/PscIde.js | |||
@@ -38,7 +38,7 @@ function connect(psModule) { | |||
38 | ideClient.stderr.on('data', data => { | 38 | ideClient.stderr.on('data', data => { |
39 | debug(data.toString()) | 39 | debug(data.toString()) |
40 | cache.ideServer = false | 40 | cache.ideServer = false |
41 | reject(true) | 41 | reject(new Error('psc-ide-client failed')) |
42 | }) | 42 | }) |
43 | ideClient.stdout.once('data', data => { | 43 | ideClient.stdout.once('data', data => { |
44 | debug(data.toString()) | 44 | debug(data.toString()) |
@@ -49,11 +49,11 @@ function connect(psModule) { | |||
49 | resolve(psModule) | 49 | resolve(psModule) |
50 | } else { | 50 | } else { |
51 | cache.ideServer = ideServer | 51 | cache.ideServer = ideServer |
52 | reject(true) | 52 | reject(new Error('psc-ide-client failed')) |
53 | } | 53 | } |
54 | } else { | 54 | } else { |
55 | cache.ideServer = false | 55 | cache.ideServer = false |
56 | reject(true) | 56 | reject(new Error('psc-ide-client failed')) |
57 | } | 57 | } |
58 | }) | 58 | }) |
59 | ideClient.stdin.resume() | 59 | ideClient.stdin.resume() |
@@ -135,7 +135,7 @@ function rebuild(psModule) { | |||
135 | if (res && !Array.isArray(res.result)) { | 135 | if (res && !Array.isArray(res.result)) { |
136 | return res.resultType === 'success' | 136 | return res.resultType === 'success' |
137 | ? resolve(psModule) | 137 | ? resolve(psModule) |
138 | : reject('psc-ide rebuild failed') | 138 | : reject(new Error('psc-ide rebuild failed')) |
139 | } | 139 | } |
140 | 140 | ||
141 | Promise.map(res.result, (item, i) => { | 141 | Promise.map(res.result, (item, i) => { |
@@ -153,10 +153,10 @@ function rebuild(psModule) { | |||
153 | })) | 153 | })) |
154 | .then(() => request({ command: 'load' })) | 154 | .then(() => request({ command: 'load' })) |
155 | .then(resolve) | 155 | .then(resolve) |
156 | .catch(() => reject('psc-ide rebuild failed')) | 156 | .catch(() => reject(new Error('psc-ide rebuild failed'))) |
157 | } | 157 | } |
158 | cache.errors = compileMessages.join('\n') | 158 | cache.errors = compileMessages.join('\n') |
159 | reject('psc-ide rebuild failed') | 159 | reject(new Error('psc-ide rebuild failed')) |
160 | } else { | 160 | } else { |
161 | cache.warnings = compileMessages.join('\n') | 161 | cache.warnings = compileMessages.join('\n') |
162 | resolve(psModule) | 162 | resolve(psModule) |