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

Improve stream error handling #228

Closed
ehmicky opened this issue May 10, 2019 · 1 comment · Fixed by #271
Closed

Improve stream error handling #228

ehmicky opened this issue May 10, 2019 · 1 comment · Fixed by #271

Comments

@ehmicky
Copy link
Collaborator

ehmicky commented May 10, 2019

When maxBuffer is reached, the rejected error has a different shape than usual:

{
	"name": "MaxBufferError",
	"bufferedData": "...",
	"stream": "stdout"
}

Shouldn't it have the same shape? For example:

// No `code`, `exitCode`, `exitCodeName`, `signal`
{
	// If available
	stdout,
	stderr, 
	all,

	// This indicates a stream error
	stream: "stdout",
	// This indicates a stream error due to `maxBuffer`
	maxBuffer: true|false,

	failed: true,
	timedOut: false,
	isCanceled: false,
	
	command: "...",
}

stdout, stderr and all could either:
a) be present only if the whole stream finished before the error
b) show the partially bufferedData

The error message could be made more descriptive as well.

I can submit a PR if you think that's a good idea.

@sindresorhus
Copy link
Owner

Yes. Good catch. That's really just an oversight. PR welcome.

b) show the partially bufferedData

👍 Just make sure to document this behavior in the readme/TS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants