Skip to content

Handle nil (msgpack.NULL) result from lua function #69

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

Closed
anton-putau opened this issue Oct 24, 2016 · 0 comments
Closed

Handle nil (msgpack.NULL) result from lua function #69

anton-putau opened this issue Oct 24, 2016 · 0 comments

Comments

@anton-putau
Copy link
Contributor

anton-putau commented Oct 24, 2016

I am trying to get response from lua function and got exception with lua nil value or msgpack.NULL:

// C# code
using TaskModel = global::Tarantool.Client.Model.Tuple<int, string, string>;
using TimeOutModel = global::Tarantool.Client.Model.Tuple<string, int>;

var result = await this.box.Call<TimeOutModel, TaskModel>(TarantoolFunctionNames.TakeQueueItemFunctionName, Tuple.Create(queueName, timeout));

// Lua code
local function take_queue(queueName, timeoutSeconds)
    result = queue.tube[queueName]:take(timeoutSeconds)
    log.info("take from queue %s. result is %s", queueName, result)

    if(result == nil) then
        log.info("return NULL %s",msgpack.NULL)
        return msgpack.NULL
    end

    return result
end

Exception:

System.ArgumentException : Invalid array length: 3 is expected, but got 1. at Tarantool.Client.LogicalConnection.<SendRequestImpl>d__112.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Tarantool.Client.LogicalConnection.<SendRequest>d__72.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Tarantool.Client.Box.<Call>d__82.MoveNext()

Expected behavior: no exceptions, result.Data = empty array || null

@anton-putau anton-putau changed the title Handle nil result from lua function Handle nil (msgpack.NULL) result from lua function Oct 24, 2016
aensidhe added a commit that referenced this issue Oct 26, 2016
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

2 participants