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

Writing to stderr from CLI encoder #70

Open
Stebalien opened this issue Mar 5, 2018 · 3 comments
Open

Writing to stderr from CLI encoder #70

Stebalien opened this issue Mar 5, 2018 · 3 comments

Comments

@Stebalien
Copy link
Member

So, the old interface provided access to stderr. The new one assumes that all values emitted should go to stdout. It assumes that all errors should be returned via SetError. Unfortunately, this makes it impossible to migrate some commands without breaking the API.

Also, as I've stated in #62, I'd like to just use SetError for terminal errors. That is, "status" errors are just output.

@Stebalien Stebalien changed the title Writing to stderr from commands Writing to stderr from CLI encoder Mar 5, 2018
@Stebalien
Copy link
Member Author

Unfortunately, we've completely mixed CLI encoding with encoding for transport (HTTP, writer, etc.) so fixing this won't be fun at all.

@Stebalien
Copy link
Member Author

So, I tried using a PostRun to fix this (splitting out errors from non-errors in the post run). However, it turns out that correctly handling errors from res.Next() is an utter nightmare and not even HandleError does this correctly (it doesn't take multiple errors into account). Given that none of our code uses this "multiple error" system, I'm going to assume that anything that tries to use it will break horribly.

@Stebalien
Copy link
Member Author

One solution is to return the error as an error from the encoder. However, we'll need to modify the encoding logic to continue when it encounters an error.

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

No branches or pull requests

1 participant