// SAFETY: bridge methods are only invoked from threads holding the GVL
let ruby = unsafe { magnus::Ruby::get_unchecked() };
let value = self.inner.get_inner_with(&ruby);
let val: magnus::Value = match {{ call }} {
Ok(v) => v,
Err(e) => {
{%- if has_error %}
return Err({{ err_expr }});
{%- else %}
// This method's Rust signature is infallible, so a Ruby exception cannot
// propagate. Log before substituting the default — a silent default is
// indistinguishable from a real result to the caller.
eprintln!("[{{ wrapper }}] host '{{ method_name }}' raised; returning default: {e}");
return Default::default();
{%- endif %}
}
};
{%- if is_unit %}
let _ = val;
{%- if has_error %}
Ok(())
{%- endif %}
{%- endif %}