Skip to content

Commit

Permalink
fix: Remove panic in fetch handler
Browse files Browse the repository at this point in the history
Per rust-lang/rust#58874
re-entering a webasm instance that paniced is undefined behavior.

The #[event(fetch)] macro currently inserts a panic in the case
that the fetch handler returns an `Err`, this removes that panic.
  • Loading branch information
gmorenz committed Nov 8, 2021
1 parent 7f5a01e commit 33aa465
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion worker-macros/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ pub fn expand_macro(attr: TokenStream, item: TokenStream) -> TokenStream {
}
}
false => {
quote! { panic!("{}", e) }
quote! {
Response::error("Error: Internal Error", 500).unwrap().into()
}
}
};

Expand Down

0 comments on commit 33aa465

Please sign in to comment.