-
Notifications
You must be signed in to change notification settings - Fork 4
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
Unexpected response on connect tear #7
Comments
@DifferentialOrange what you expect to see? EOF seems fine to me. Segmentation fault? Do you call Go panic a segmentation fault? |
In case of ordinary error, there is a usual structure: eval := tarantool.Eval("error('err')", []interface{}{})
resp1, err1 := conn.Exec(eval)
log.Println(resp1.Code)
log.Println(resp1.Data)
log.Println(err1) logs out
So in case of request error response structure is still returned. Or is it not in convention to always return this structure? I don't know if it's hard to handle, but seeing more readable error like |
I see. Well, looking at error handling in general – it's a bit confusing here at the moment. I think func (conn *Connection) Exec(req *Request) ([]interface{}, error) {...} This may remove ambiguity in error handling. Especially since methods like: func (conn *Connection) ExecTyped(req *Request, result interface{}) error {...} – already only have In this case even if Need some more research whether this makes sense though. What do you think? |
The issue here is based on tarantool/go-tarantool#129 : all connector examples in README have this log.Println(resp.Code)
log.Println(resp.Data)
log.Println(err) output print and returning I agree that the question needs research (including verifying return conventions and examples in |
In Go if an error returned from a function call in most cases response is unusable. So this does not surprise me. But I am not fully understand why we want to stick to |
There are also response codes, but I don't know if they are any use cases. |
Merged #8 -error handling should be more intuitive. I have not changed the type of error returned on connection close - it's still io.EOF, but I don't think this is a problem in general. Let's see how it goes – we can adjust sth later if required. |
Behavior for this connector is similar as in tarantool/go-tarantool, see here: tarantool/go-tarantool#129
Tarantool setup
Go code
If I stop running Tarantool with
Ctrl+C
golang printsResponse
resp
do not haveCode
andData
fields as usual, attempt to extract them results in segmentation fault; error seems useless.The text was updated successfully, but these errors were encountered: