Use a non-fatal diag handler in the C API. FIxes PR22368.