Commit 4de984d
committed
finding 2: use JS-provided throw_or_abort_impl for WASM error recovery
In WASM builds, BB_NO_EXCEPTIONS is defined which routes throw_or_abort
to std::abort(), killing the WASM process on any error with no recovery.
The fix: don't compile the C++ definition of throw_or_abort_impl for
WASM builds (#ifndef __wasm__). The header already declares it as a
WASM_IMPORT from the JS environment, where it throws a catchable JS
Error. With the competing C++ definition removed, the JS import is
used, and errors propagate as JS exceptions back to the TS caller
instead of aborting the process.1 parent e882aec commit 4de984d
File tree
2 files changed
+15
-3
lines changed- barretenberg/cpp/src/barretenberg
- bbapi
- env
2 files changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | | - | |
29 | | - | |
30 | 32 | | |
31 | | - | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | 9 | | |
3 | 10 | | |
| |||
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| 37 | + | |
| 38 | + | |
0 commit comments