-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
asyncLoad: fix empty error message #21889
base: main
Are you sure you want to change the base?
Conversation
Before: ``` [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] { code: 'ERR_UNHANDLED_REJECTION' } ``` After: ``` [Error: ENOENT: no such file or directory, open 'A:\path\to\foo.wasm'] { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'A:\\path\\to\\foo.wasm' } ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
if (onerror) { | ||
onerror(); | ||
onerror(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the first few users of this and didn't see any that use the parameter - where did you see it used? Or was this for an out-of-tree usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kojoley could you elaborate on what API you were using when you saw the difference above? How where you using it exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir link_test
echo ; > link_test.cpp
emcc -fPIC -sSIDE_MODULE -Wall -g -c "link_test.cpp" -o "link_test.o"
emcc -fPIC -sSIDE_MODULE "link_test.o" -o "link_test/foo.wasm"
echo int main() { return 0; } > main.cpp
emcc -fPIC -sMAIN_MODULE -Wall -g -c "main.cpp" -o "main.o"
emcc -fPIC -sMAIN_MODULE "main.o" "link_test/foo.wasm" -o "link_test.js"
node link_test.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know where in that output it uses the parameter? Or is it hard to figure out? (I'd hope you can add console.log(new Error().stack)
right where the parameter is received, to show the stack trace.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not the person that can comfortably debug that for you, sorry. I don't write Javascript nor have a clue about emscripten internals. It took me a while already to get to this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the repro case. I think this change is good but I will do a little more investigation here before landing so I (we) fully understand what is going on here.
} else { | ||
throw `Loading data file "${url}" failed.`; | ||
throw err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it makes sense to keep the text here? The context could be nice. I'm not sure if there's a way to append more text to an existing Error object, though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the OP/commit message, readAsync already has the accurate error information, this does not add any additional information, quite an opposite, it has less information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. So the text "Loading data file .. failed" was swallowed somewhere, I guess? Anyhow, sounds good that this improves things.
Before:
After: