nickbabcock/collectd-rust-plugin

Catch Rust Panics

nickbabcock opened this issue · 0 comments

A properly written plugin will not panic (instead, it will return an Error). Still, mistakes happen and catching panics is the polite thing to do for collectd (collectd should still run if a rust plugin panics). I looked into panic::catch_unwind, but received the following error:

let read_panic = catch_unwind(|| plugin.read_values());
                 ^^^^^^^^^^^^ the type &mut std::boxed::Box<std::boxed::Box<plugins::Plugin>> may not be safely transferred across an unwind boundary

I'm not sure what the solution is here 🤔