Skip to content

Commit

Permalink
Remove possibly-incorrect handling of Rust panics in callback
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Apr 24, 2020
1 parent 9c61710 commit 8d35ff8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/types/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ impl<T: Value> Callback<raw::Local> for FunctionCallback<T> {
if let Ok(value) = convert_panics(|| { dynamic_callback(cx) }) {
value.to_raw()
} else {
// TODO this should probably not be null
std::ptr::null_mut()
// What should we return if the function panicked?
//
// `ptr::null_mut()` may work, but we should have a test to verify that, which
// can be created after [#505][0]. For now, let's not guess!
//
// [0]: https://github.com/neon-bindings/neon/pull/505.
unimplemented!("cannot return from function after a panic")
}
})
}
Expand Down

0 comments on commit 8d35ff8

Please sign in to comment.