You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-2Lines changed: 64 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,10 @@ Use [cargo generate](https://github.com/cargo-generate/cargo-generate) to start
48
48
cargo generate cloudflare/workers-rs
49
49
```
50
50
51
-
There are several templates to chose from. You should see a new project layout with a `src/lib.rs`.
52
-
Start there! Use any local or remote crates and modules (as long as they compile to the `wasm32-unknown-unknown` target).
51
+
There are several templates to choose from. During generation you will be prompted to enable
52
+
`panic=unwind` and abort recovery (see [Panic Recovery](#panic-recovery-with---panic-unwind)
53
+
below). You should see a new project layout with a `src/lib.rs`. Start there! Use any local or
54
+
remote crates and modules (as long as they compile to the `wasm32-unknown-unknown` target).
53
55
54
56
Once you're ready to run your project, run your worker locally:
55
57
@@ -439,6 +441,66 @@ allows you to describe your RPC interface using WIT and generate JavaScript bind
439
441
[rpc-client example](./examples/rpc-client/wit/calculator.wit). The easiest way to use this code generator is using a [build script](./examples/rpc-client/build.rs) as shown in the example.
440
442
This code generator is pre-alpha, with no support guarantee, and implemented only for primitive types at this time.
441
443
444
+
## Panic Recovery with `--panic-unwind`
445
+
446
+
By default, Rust panics in Workers compile with `panic=abort`, which terminates the WebAssembly
447
+
instance. The `--panic-unwind` flag for `worker-build` changes this behavior so that panics are
448
+
caught and converted to JavaScript exceptions, allowing the Worker to continue serving requests
0 commit comments