-
Notifications
You must be signed in to change notification settings - Fork 29
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
Properly handle success result for live stream #227
Properly handle success result for live stream #227
Conversation
Hi @vkuptcov Nice catch! Thanks for the contribution! |
Upon further review, I don't think the code in this PR will do anything, but it wouldn't hurt having it. Hopefully, that fixed your problem. |
@dvonthenen deepgram-go-sdk/pkg/client/live/client.go Line 278 in a036640
In general, I would suggest to get rid of using direct errors comparison like here |
You are absolutely right. It will return The reason why we are using the direct error comparison is because the behavior is different depending on the error. For The behavior you are seeing versus what I am seeing appear to be vastly different. What version of go are you using? I can run the example without any issues or segfaults. |
|
Will give this a try using the latest 1.22. |
I dont have any problem running the example on In any case, the new code shouldn't hurt. |
I'll create a simple project to illustrate the issue. |
No need. I definitely understand, but drop it here if you wish. |
Proposed changes
This PR fixes error handling inside
func (c *Client) Stream(r io.Reader) error
function.The current implementation tries to call
err.Error()
in the first switchcase strings.Contains(err.Error(), FatalReadSocketErr)
.It leads to a panic in case of handling successful results.
Types of changes
What types of changes does your code introduce to the community Go SDK?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments