conduit icon indicating copy to clipboard operation
conduit copied to clipboard

Errors crash the code when using C interface

Open eschnett opened this issue 10 months ago • 2 comments

I notice that run-time errors (e.g. trying to open a non-existing file) throw an exception. The C interface doesn't allow catching these exceptions and thus always crash the code.

I am currently examining writing a Julia wrapper https://github.com/eschnett/Conduit.jl using the C interface and this would be a serious problem.

eschnett avatar Feb 25 '25 17:02 eschnett

@eschnett thanks for this report and we understand this issue.

Here is a related discussion of a possible path forward:

https://github.com/LLNL/conduit/issues/1065

To summarize - two options:

  • Provide an error status function and try / catch to avoid exceptions reaching C -- (I think this is pragmatic path foward)

  • A new C API that provides error code for all calls.

cyrush avatar Feb 26 '25 14:02 cyrush

Thanks. (FWIW, from a cleanliness point of view I'd prefer a new API that returns error codes.)

eschnett avatar Feb 26 '25 14:02 eschnett