nbigaouette / onnxruntime-rs

Rust wrapper for Microsoft's ONNX Runtime (version 1.8)
Apache License 2.0
283 stars 100 forks source link

More consistent error handling #86

Closed krlohnes closed 3 years ago

krlohnes commented 3 years ago

Error handling should be left up to the user of the library in general. Most of this change (aside from some integration test compile problems), is removing panics.

In asserting a null pointer or not, we return a Result instead of panicking.

In drops, instead of asserting a non null pointer, we just check is_null on the object before running the C deallocation function for the pointer and log an error if its null when we're trying to deallocate.

nbigaouette commented 3 years ago

Awesome, thanks for your contribution!