Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiledb-rs error styling part 1: Context::capi_call returns its own error type #191

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rroelke
Copy link
Collaborator

@rroelke rroelke commented Nov 20, 2024

In tiledb-tables, we've begun to declare at least one Error enum per module. If a module foo calls a function from a module bar, then foo::Error has an enum variant approximating Bar(bar::Error). This can help build a causality chain in error output.

We have discussed bringing this error style into tiledb-rs, and this pull request is a foray into doing so. We begin with the core of tiledb-rs, Context::capi_call. This pull request adds CApiError which is returned by Context::capi_call. The rest of the changes fell out of that in some way.

There are a few // SAFETY comments for new unwraps. These are added in situations where we try to convert a value returned from tiledb into one of the tiledb-rs enums. The presupposition is that if libtiledb returned TILEDB_OK then it must have given a valid enum value. I am personally comfortable with this assumption (I believe I am aligned with this blog about unwrap) but I'm also fine changing it if requested - it would nudge the code in the direction of more Error variants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant