llnl / llnl/conduit

Error Handling for the C Interface

Open
#1,065 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
248
Forks
72
Avg merge
1d 16h
Merged PRs (30d)
15

Description

At the moment the error handling capabilities for the C interface are relatively crude and limited to a triplet of callback functions as per:

https://github.com/LLNL/conduit/blob/develop/src/libs/conduit/c/conduit_utils.h

However, this makes it difficult for multiple libraries using conduit to play nice with one another as each library may try and install its own error handler. In addition, it can be complex to wire up the error handler (as in the common case of seeing if a conduit API call which might try and allocate a large amount of memory is successful or not). With return status codes this is trivial, with callbacks it can be a pain.

Given that the ABI is mostly fixed and it is likely difficult to change the `void` marked methods, would it be possible to associate with each node an status member. If something goes wrong with an operation on a node this status flag can be set (extra points if you want to use the new C++23 stacktrace functionality to grab extra info). Then a new method can be added to query the status of a node (recursing as appropriate).

Code which is being extra careful can then call this after each API call. More mainstream code can simply call it at the end of setting up all of their Conduit nodes. This makes it possible to handle errors locally and in a timely fashion but without forcing everyone to opt into handling a result of every single API call.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C interface described in src/libs/conduit/c/conduit_utils.h and review its triplet of callback functions alongside the node operations that can fail. Define the status representation, querying behavior, and compatibility approach before implementation; done means errors can be checked locally without forcing every existing void-marked API call to return a result.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.