Skip to content

Unhandled promise rejection #395

Closed
Closed

Description

@hongzhidao

Hi,
I'd like to share a related NodeJS issue about the promise rejection.
nodejs/node#20392

I tested with NodeJS and Chrome, and they regard this as an error, but it gets discarded in QuickJS.

new Promise((resolve, reject) => {
    resolve('ok')
})
.then(result => {
    call_inexistent_func();
})

Thanks.

Activity

  1. nickva commented on Mar 26, 2025

    @nickva
    Contributor

    You can see the error if you set a JS_SetHostPromiseRejectionTracker.

    In qjs there is an option for it:

    % qjs --unhandled-rejection
    
    qjs > new Promise((resolve, reject) => {resolve('ok')}).then(result => {call_inexistent_func();})
    Possibly unhandled promise rejection: ReferenceError: 'call_inexistent_func' is not defined
        at <anonymous> (<evalScript>)
    
  2. hongzhidao commented on Mar 27, 2025

    @hongzhidao
    Author

    Hi @nickva,
    It works well, thanks for the point.

  3. hongzhidao commented on Mar 27, 2025

    @hongzhidao
    Author

    @nickva,
    BTW, what do you think of the change?
    quickjs-ng/quickjs@11b7592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions