GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
554 stars 79 forks source link

[BUG] Firestore .get() breaks if you are connected with on_document_error() #161

Closed BearDooks closed 3 years ago

BearDooks commented 3 years ago

https://github.com/GodotNuts/GodotFirebase/blob/0dcabd4f410058c656d3f000ad733990edf42e3c/addons/godot-firebase/firestore/firestore_task.gd#L155

This line when called with return an error since the function in firestore_collection is looking for three arguments and this is only passing one.

Original lines:

    else:
        match action:
            Task.TASK_LIST, Task.TASK_QUERY:
                data = bod[0].error
                emit_signal("error", bod[0].error)
            _:
                data = bod.error
                emit_signal("error", bod.error)

Updated lines that work:

    else:
        match action:
            Task.TASK_LIST, Task.TASK_QUERY:
                data = bod[0].error
                emit_signal("error", bod[0].error)
            _:
                data = bod.error
                emit_signal("error", data.code, 0, data.message)

Something that we need to look into. I don't enjoy hardcoding a 0 into the error message, and it is possible that the other match case might error was well since it falls into the same issue.