Skip to content

Commit 1374001

Browse files
committed
Expose the error in 'error' events.
1 parent 99ac74c commit 1374001

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Node/Stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ exports.onEnd = function(s) {
5050
exports.onError = function(s) {
5151
return function(f) {
5252
return function() {
53-
s.on('error', function() {
54-
f();
53+
s.on('error', function(e) {
54+
f(e)();
5555
});
5656
};
5757
};

src/Node/Stream.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import Node.Buffer (Buffer())
3535
import Node.Buffer as Buffer
3636

3737
import Control.Monad.Eff
38-
import Control.Monad.Eff.Exception (throw, EXCEPTION())
38+
import Control.Monad.Eff.Exception (throw, EXCEPTION(), Error())
3939
import Control.Monad.Eff.Unsafe (unsafeInterleaveEff)
4040

4141
-- | A stream.
@@ -106,7 +106,7 @@ foreign import onEnd :: forall w eff. Readable w eff -> Eff eff Unit -> Eff eff
106106
foreign import onClose :: forall w eff. Readable w eff -> Eff eff Unit -> Eff eff Unit
107107

108108
-- | Listen for `error` events.
109-
foreign import onError :: forall w eff. Readable w eff -> Eff eff Unit -> Eff eff Unit
109+
foreign import onError :: forall w eff. Readable w eff -> (Error -> Eff eff Unit) -> Eff eff Unit
110110

111111
-- | Resume reading from the stream.
112112
foreign import resume :: forall w eff. Readable w eff -> Eff eff Unit

0 commit comments

Comments
 (0)