-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Exception throw even though code is inside try/catch #3926
Comments
You're catching by non-const reference. What if you catch by const reference or by value? I see |
Hi @gregmarr, Yes, it is a WebAssembly build. I tried in a simple file in my local machine without WASM context and it compiles and run without problems:
Can be a problem with WebAssembly only? Thanks. |
The exceptions of the library inherit from std::exception (see https://json.nlohmann.me/home/exceptions/), so the code looks fine. Very strange. |
Are you using Emscripten? https://emscripten.org/docs/porting/exceptions.html |
Hi, Yes, im using. Im trying to compile a simple with it and always throw error. I tried all emscripten compile flags. |
Solved now. The problem is that i need use the flags on CXX_FLAGS too:
Thanks. |
You're welcome. Glad you were able to sort it out. |
Description
Even though my code is inside a try it is throwing exception and stopping the program.
Reproduction steps
Only need call the example function:
Expected vs. actual results
Excepted is return the default value when exception happen.
Actual result is crashing.
Minimal code example
The text was updated successfully, but these errors were encountered: