feat: [sesam-vitale] Use thiserror, anyhow and expect to properly handle errors instead of unwrap

This commit is contained in:
2024-08-15 19:27:57 +02:00
parent 3f476c3114
commit 760a9cd92c
7 changed files with 229 additions and 124 deletions

View File

@ -3,6 +3,13 @@
/// Low level bindings to the SSVLIB dynamic library.
// TODO : look for creating a dedicated *-sys crate : https://kornel.ski/rust-sys-crate
use libc::{c_char, c_ushort, c_void, size_t};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum LibSSVError {
#[error("SSV library error in {function}: {code}")]
StandardErrorCode { code: u16, function: &'static str },
}
#[cfg_attr(target_os = "linux", link(name = "ssvlux64"))]
#[cfg_attr(target_os = "windows", link(name = "ssvw64"))]