#[allow(dead_code)]
fn alef_napi_err<E: std::fmt::Display + 'static>(e: E) -> napi::Error {
let message = e.to_string();
let boxed: Box<dyn std::any::Any> = Box::new(e);
{% for rust_path, converter in converters %}
let boxed = match boxed.downcast::<{{ rust_path }}>() {
Ok(typed) => return {{ converter }}(*typed),
Err(other) => other,
};
{% endfor %}
drop(boxed);
napi::Error::new(napi::Status::GenericFailure, message)
}