Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FileWriteStream throws error when no longer writeable (should emit?) #85

Closed
tj opened this Issue · 4 comments

2 participants

@tj
tj commented

Kind of annoying to add an "error" listener as well as wrapping with try/catch,
I expected this error to be emitted:
...
this.write = function(data, cb) {
if (!this.writeable) {
throw new Error('stream not writeable');
}
...

@isaacs
Owner

I agree, especially since emit('error') will throw anyway if unhandled.

Fix: https://gist.github.com/828923

@isaacs
Owner

Closed by f3d3641 Emit error rather than throwing.

Since "error" events will throw when unhandled anyhow, it makes no sense
to throw from an EventEmitter's method, especially for such a minor
misdemeanor as attempting to write to a non-writable stream.

@coolaj86 coolaj86 referenced this issue from a commit
@isaacs isaacs Closes GH-85 Emit error rather than throwing.
Since "error" events will throw when unhandled anyhow, it makes no sense
to throw from an EventEmitter's method, especially for such a minor
misdemeanor as attempting to write to a non-writable stream.
f3d3641
@coolaj86 coolaj86 referenced this issue from a commit
@isaacs isaacs Closes GH-85 Emit error rather than throwing.
Since "error" events will throw when unhandled anyhow, it makes no sense
to throw from an EventEmitter's method, especially for such a minor
misdemeanor as attempting to write to a non-writable stream.
11a06fe
@coolaj86 coolaj86 referenced this issue from a commit
@ry ry Revert "Closes GH-85 Emit error rather than throwing."
This reverts commit f3d3641.

Landed in master instead.
fbe36a7
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.