aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Psc.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Psc.js')
-rw-r--r--src/Psc.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Psc.js b/src/Psc.js
index 437eb91..8fe8437 100644
--- a/src/Psc.js
+++ b/src/Psc.js
@@ -40,10 +40,16 @@ function compile(psModule) {
40 debug('finished compiling PureScript.') 40 debug('finished compiling PureScript.')
41 cache.compilationFinished = true 41 cache.compilationFinished = true
42 if (code !== 0) { 42 if (code !== 0) {
43 cache.errors = stderr.join('') 43 const errorMessage = stderr.join('');
44 if (errorMessage.length) {
45 psModule.emitError(errorMessage);
46 }
44 reject(new Error('compilation failed')) 47 reject(new Error('compilation failed'))
45 } else { 48 } else {
46 cache.warnings = stderr.join('') 49 const warningMessage = stderr.join('');
50 if (options.warnings && warningMessage.length) {
51 psModule.emitWarning(warningMessage);
52 }
47 resolve(psModule) 53 resolve(psModule)
48 } 54 }
49 }) 55 })
@@ -83,7 +89,10 @@ function bundle(options, cache) {
83 compilation.on('close', code => { 89 compilation.on('close', code => {
84 debug('finished bundling PureScript.') 90 debug('finished bundling PureScript.')
85 if (code !== 0) { 91 if (code !== 0) {
86 cache.errors = (cache.errors || '') + stderr.join('') 92 const errorMessage = stderr.join('');
93 if (errorMessage.length) {
94 psModule.emitError(errorMessage);
95 }
87 return reject(new Error('bundling failed')) 96 return reject(new Error('bundling failed'))
88 } 97 }
89 cache.bundle = stderr 98 cache.bundle = stderr