unqlite.rs icon indicating copy to clipboard operation
unqlite.rs copied to clipboard

Make error codes available

Open mgrand opened this issue 3 years ago • 0 comments

Right now, the only way I see for a program calling the UnQLite wrapper to know the nature of an error is to compare the error string associated with the error with the string literals in UnQLite's error.rs. This seems unsafe.

The Custom struct that is returned for the error contains UnQLite's numeric error code and the ErrorKind enum variant that the wrapper assigned to it. However, even though the ErrorKind enum is public, the fields of the UnQLite struct are private and there is no way for the calling program to access this.

Please add methods to access the fields of a Custom struct:

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Custom {
    kind: ErrorKind,
    raw: i32,
}

mgrand avatar Jan 17 '22 15:01 mgrand