forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
In the comment to the GetResponse method it says:
// GetResponse waits for Future to be filled and returns Response and error.
//
// Note: Response could be equal to nil if ClientError is returned in error.
//
// "error" could be Error, if it is error returned by Tarantool,
// or ClientError, if something bad happens in a client process.
func (fut *Future) GetResponse() (Response, error)But the actual behavior is different. When an error returns from tarantool, I don't get it.
Here is an example of tarantool configuration:
box.cfg({
listen = 3301,
memtx_memory=128 * 1024 * 1024,
read_only=false,
})
box.once('bootstrap', function()
box.schema.user.create('test_user', { password = 'test_password' })
box.schema.user.grant('test_user', 'read,write,execute', 'universe')
end)
api = {}
api.error = function()
error("test error")
endAnd when calling Do with CallRequest, the problem starts. I don't get an error when calling GetResponse from Feature, but only when calling Decode. The behavior differs from the method comment.
func (s *Storage) Call(
ctx context.Context,
functionName string,
args any,
) (tarantool.Response, error) {
req := tarantool.NewCallRequest(functionName).
Context(ctx).
Args(args)
return s.client.Do(req).GetResponse()
}
// ...
resp, err := storage.Call(ctx, "api.error", []any{})
// test error should return here, but here is nil
if err != nil {
return err
}
data, err := resp.Decode()
// Actually test error returns here
if err != nil {
return err
}Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog