While writing bindings to the Discord Game SDK, I started taking a very conservative approach to error handling and decided to catch any error I could.
Some errors have an almost impossible chance to crop up (pointers being null, UTF8 conversion failing, invalid enums) as the SDK itself is written in Rust, however only available through C bindings.
I’m beginning to wonder if I should continue on this path as it seems to become limiting now that I’m trying to implement iterators that end up making FFI calls (there is no way to express an error during iteration as far as I’m aware).
What are your thoughts on my issue?
What are examples of wrappers/bindings you find most idiomatic?
How much do you value safety in wrappers/bindings?
I couldn’t really find similar topics on this forum and through google searches, but if you know of similar discussions, I’d be happy to read up.
The repo is available https://github.com/ldesgoui/discord_game_sdk, I apologize for the mess, it’s very much work in progress.