Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors,stream-transform: migrate to use internal/errors.js #13310

Closed

Conversation

@sreepurnajasti
Copy link
Contributor

@sreepurnajasti sreepurnajasti commented May 30, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

lib/_stream_transform.js

ref: #11273

lib/_stream_transform.js Outdated

if (ts.transforming)
throw new Error('Calling transform done when still transforming');
throw new errors.Error('ERR_CALLING_IN_TRANSFORMING',
'Calling transform done when still transforming');

This comment has been minimized.

@kunalspathak

kunalspathak May 30, 2017
Member

'Calling transform done when still transforming' [](start = 27, length = 48)

don't need this anymore?

This comment has been minimized.

@sreepurnajasti

sreepurnajasti May 31, 2017
Author Contributor

@kunalspathak Thanks. It's done.

test/parallel/test-stream-transform-callback-twice.js Outdated
@@ -8,7 +8,8 @@ const stream = new Transform({

stream.on('error', common.mustCall((err) => {
assert.strictEqual(err.toString(),
'Error: write callback called multiple times');
'Error [ERR_MULTIPLE_WRITE_CALLBACK]:' +
' write callback called multiple times');

This comment has been minimized.

@kunalspathak

kunalspathak May 30, 2017
Member

[](start = 22, length = 1)

nit: can you move the space on above line?

This comment has been minimized.

lib/internal/errors.js Outdated
@@ -139,6 +142,7 @@ E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected');
E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe');
E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks');
E('ERR_MISSING_ARGS', missingArgs);
E('ERR_MULTIPLE_WRITE_CALLBACK', 'write callback called multiple times');

This comment has been minimized.

@jasnell

jasnell May 30, 2017
Member

If I recall correctly, there are a couple of places in core with a similar error. A more generic error message may be appropriate.

This comment has been minimized.

@sreepurnajasti

sreepurnajasti May 31, 2017
Author Contributor

@jasnell Modified the error message to be more generic. Thanks

@sreepurnajasti sreepurnajasti force-pushed the sreepurnajasti:stream-transform branch May 31, 2017
@kunalspathak
Copy link
Member

@kunalspathak kunalspathak commented May 31, 2017

@sreepurnajasti - Changes incorporated from my feedback looks good although I kind of don't like ERR_CALLING_WS_LENGTH as the reader doesn't easily get the intent of the error message. I will leave it to @jasnell to comment on this.

lib/_stream_transform.js Outdated
@@ -217,10 +218,10 @@ function done(stream, er, data) {
var ts = stream._transformState;

if (ws.length)
throw new Error('Calling transform done when ws.length != 0');
throw new errors.Error('ERR_CALLING_WS_LENGTH');

This comment has been minimized.

@mhdawson

mhdawson May 31, 2017
Member

I'd agree a better name for the error would be good. Maybe 'ERR_TRANSFORM_WITH_LENGTH_0'.

This comment has been minimized.

@sreepurnajasti

sreepurnajasti Jun 13, 2017
Author Contributor

@mhdawson Done

lib/_stream_transform.js Outdated
@@ -90,7 +91,7 @@ function afterTransform(stream, er, data) {

if (!cb) {
return stream.emit('error',
new Error('write callback called multiple times'));
new errors.Error('ERR_MULTIPLE_CALLBACK'));

This comment has been minimized.

@mhdawson

mhdawson May 31, 2017
Member

Maybe to be consistent with my other suggestion:
'ERR_TRANSFORM_MULTIPLE_CALLBACK'.

This comment has been minimized.

@sreepurnajasti

sreepurnajasti Jun 13, 2017
Author Contributor

@mhdawson Fixed.

lib/_stream_transform.js Outdated

if (ts.transforming)
throw new Error('Calling transform done when still transforming');
throw new errors.Error('ERR_CALLING_IN_TRANSFORMING');

This comment has been minimized.

@mhdawson

mhdawson May 31, 2017
Member

Maybe to be consistent with my other suggestion:
'ERR_TRANSFORM_ALREADY_TRANSFORMING' String is already specific to transform so making that part of the ID makes sense to me.

This comment has been minimized.

@sreepurnajasti

sreepurnajasti Jun 13, 2017
Author Contributor

@mhdawson Done

@sreepurnajasti sreepurnajasti force-pushed the sreepurnajasti:stream-transform branch Jun 12, 2017
@sreepurnajasti
Copy link
Contributor Author

@sreepurnajasti sreepurnajasti commented Jun 12, 2017

@mhdawson @jasnell As per the suggestions, it is modified. Please, have a look.

@sreepurnajasti sreepurnajasti force-pushed the sreepurnajasti:stream-transform branch 2 times, most recently Jun 14, 2017
@sreepurnajasti sreepurnajasti force-pushed the sreepurnajasti:stream-transform branch to 9ba9855 Jun 14, 2017
@mhdawson
Copy link
Member

@mhdawson mhdawson commented Jun 15, 2017

CI good landing

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Jun 15, 2017

Landed as d50a802

mhdawson added a commit that referenced this pull request Jun 15, 2017
PR-URL: #13310
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@TimothyGu TimothyGu closed this Jun 15, 2017
@sreepurnajasti
Copy link
Contributor Author

@sreepurnajasti sreepurnajasti commented Jun 18, 2017

@mhdawson Thank you :)

@mcollina
Copy link
Member

@mcollina mcollina commented Jun 21, 2017

I'm strongly -1 on this one. This forces some good rework on readable-stream to pull those error data. May I ask for a revert?

cc @nodejs/streams

@mcollina
Copy link
Member

@mcollina mcollina commented Jun 21, 2017

To be clear, this is something we should be doing asap, but we need to think a bit how we want to do it.

@jasnell
Copy link
Member

@jasnell jasnell commented Jun 21, 2017

:-/ ... reverting would be unfortunate. Perhaps instead, since this is semver-major and won't go out in a release any time soon, can we take a short bit of time to figure out the strategy for readable-stream? And if we can't identify a reasonable path forward, then revert...

@mcollina
Copy link
Member

@mcollina mcollina commented Jun 21, 2017

That's ok for me, there is no hurry to revert.

@refack refack added this to Done in Error Codes Aug 20, 2017
@sreepurnajasti sreepurnajasti deleted the sreepurnajasti:stream-transform branch Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Error Codes
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.