-
Notifications
You must be signed in to change notification settings - Fork 44
MakeTypedEncoder breaks when using re.SetError #65
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
Comments
Are you using this to encode responses sent over the network? The CLI response emitter should be special-casing errors and shouldn't be passing them to the encoder. |
yeah this is over http
…On 5. Mar 2018, 21:55 +0100, Steven Allen ***@***.***>, wrote:
Are you using this to encode responses sent over the network? The CLI response emitter should be special-casing errors and shouldn't be passing them to the encoder.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hm. I wonder why I've never seen this in go-ipfs. But yeah, I see the bug. |
Should be fixed with #112. |
So, this isn't fixed. We considered simply removing errors from the main stream but didn't because we consider this a part of our "API". I really don't see a sane fix. |
@whyrusleeping this can be reproduced with a simple:
(and watch how IPFS panics) |
Only use custom encoders for values. fixes #65 Also, remove SetEncoder. Always derive the correct encoder from the request.
So, I implemented what I consider to be an "acceptable" fix: #128. |
If I use
MakeTypedEncoder
, with a concrete type, say*Foo
then the error case is not handled correctly anymore, asSetError
callsre.Emit
but not with type*Foo
but rather*cmdkit.Error
.This results in a panic of
unexpected type: *cmdkit.Error
The text was updated successfully, but these errors were encountered: