Revert "Closes GH-85 Emit error rather than throwing."
authorRyan Dahl <ry@tinyclouds.org>
Thu, 3 Mar 2011 06:08:44 +0000 (22:08 -0800)
committerRyan Dahl <ry@tinyclouds.org>
Thu, 3 Mar 2011 06:10:16 +0000 (22:10 -0800)
This reverts commit f3d364122dc12f13cbfb848576a8b152849452ea.

Landed in master instead.

lib/fs.js
lib/tty_win32.js

index 0ae4550..d07a152 100644 (file)
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -1027,8 +1027,7 @@ WriteStream.prototype.flush = function() {
 
 WriteStream.prototype.write = function(data) {
   if (!this.writable) {
-    this.emit("error", new Error('stream not writable'));
-    return false;
+    throw new Error('stream not writable');
   }
 
   this.drainable = true;
index 7aa137a..6ca011a 100644 (file)
@@ -99,8 +99,7 @@ WriteStream.prototype.isTTY = true;
 
 WriteStream.prototype.write = function(data, encoding) {
   if (!this.writable) {
-    this.emit("error", new Error('stream not writable'));
-    return false;
+    throw new Error('stream not writable');
   }
 
   if (Buffer.isBuffer(data)) {