min_sqlite3_sys/
ehandle.rs

1use std::{ffi::NulError, str::Utf8Error};
2
3/// Error type that covers all kinds of errors
4/// that might occur on some of the wrapped functions.
5///
6/// # Warning
7/// This type isn't for SQL errors. In order to deal with SQL
8/// errors, consider checking `SqlPrimaryResult` enum and
9/// callback functions.
10#[derive(Debug, Clone)]
11pub struct MinSqliteWrapperError<'a> {
12    /// defines type of the error
13    pub kind: &'a str,
14    /// provides error message
15    pub reason: String,
16}
17
18impl<'a> From<NulError> for MinSqliteWrapperError<'a> {
19    fn from(error: NulError) -> Self {
20        MinSqliteWrapperError {
21            kind: "std:ffi:NulError",
22            reason: error.to_string(),
23        }
24    }
25}
26
27impl<'a> From<Utf8Error> for MinSqliteWrapperError<'a> {
28    fn from(error: Utf8Error) -> Self {
29        MinSqliteWrapperError {
30            kind: "std:str:Utf8Error",
31            reason: error.to_string(),
32        }
33    }
34}