Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

+2.2.0 doesn't reject promises when catching an error #122

@JesterIruka

Description

@JesterIruka

Issue checklist

  • I am using the latest release
  • I have referenced previously reported issues
  • I have referenced available documentation and cannot resolve the issue
  • I'm certain this is an issue with oxymysql, and not with my resource

Describe the bug
The 2.1.1 release, used to return the promise automatically created by an async function.
image
from 2.2.0 and above, the return is now a new promise, which doesn't reject when an error occur.
image

Screenshots

(2.1.1 version)
image
(Latest)
image

Code

-- creating a incorrect query on purpose to catch with pcall
CreateThread(function()
    local ox = exports.oxmysql
    local ok, err = pcall(ox.query_async, ox, 'SELECT')
    print(ok, err)
end)

Expected behavior
Reject the promise, and catch the error using pcall or try { } catch on javascript

Additional context

The 2.2.0 release replaced the old return statement to returning a new promise, which doesn't call reject, the lua coroutine is hanging forever, since the promise is never resolved.
Not sure but this behavior may cause memory leak as well, since the coroutine will wait forever.

Server details

  • FXServer artifact
    Not sure, but doesn't matter.
  • Operating system
    Windows 11

Database details
10.6.5-MariaDB-1:10.6.5+maria~focal

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions