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
Promises should ignore a second resolve/reject #1433
Comments
Hmm, just tested with 2v09.134 Linux and go this output when testing the code above. =Promise: { }
resolved
Uncaught Error: Unhandled promise rejection: undefined
> |
Thanks! Not sure what happened there then |
Any hint how to fix this? |
looking at what changed in the PR that supposedly fixed this is probably a good start: I guess what's interesting is |
Wow, there have been many changes in jswrap_promise.c since f1d7afd. Looks like is could be the section Lines 121 to 129 in 8581ba2
Just added some prints jsiConsolePrintf("L121 resolve: %d\n",resolve);
if (resolve)
jsvObjectSetChild(promise, JS_PROMISE_RESOLVED_NAME, data);
if (fn) {
_jswrap_promise_resolve_or_reject(promise, data, fn);
jsvUnLock(fn);
} else {
if (!resolve) {
jsiConsolePrintf("L129 resolve: %d\n",resolve);
jsExceptionHere(JSET_ERROR, "Unhandled promise rejection: %v", data);
}
} and that's the output: >L121 resolve: 1
resolved
L121 resolve: 1
>L121 resolve: 0
L129 resolve: 0
Uncaught Error: Unhandled promise rejection: undefined
> Hope this helps you to fix it, because I have no clue. |
What about making
} else {
if (!resolve && data)
jsExceptionHere(JSET_ERROR, "L141 Unhandled promise rejection: %v", data);
} |
Result of test with this change: |
I'm not sure that helps? try:
|
Just tested - works perfect - many thanks! |
http://forum.espruino.com/conversations/316643/#comment14243054
The text was updated successfully, but these errors were encountered: