Created
February 23, 2021 09:33
-
-
Save joaoh82/95c46f176ce62c51e36c32b7ac92f9ff to your computer and use it in GitHub Desktop.
SQLRite - error module - Part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use thiserror::Error; | |
use std::{result}; | |
use sqlparser::parser::ParserError; | |
pub type Result<T> = result::Result<T, SQLRiteError>; | |
#[derive(Error, Debug, PartialEq)] | |
pub enum SQLRiteError { | |
#[error("Not Implemented error: {0}")] | |
NotImplemented(String), | |
#[error("General error: {0}")] | |
General(String), | |
#[error("Internal error: {0}")] | |
Internal(String), | |
#[error("Unknown command error: {0}")] | |
UnknownCommand(String), | |
#[error("SQL error: {0:?}")] | |
SqlError(#[from] ParserError), | |
} | |
/// Return SQLRite errors from String | |
pub fn sqlrite_error(message: &str) -> SQLRiteError { | |
SQLRiteError::General(message.to_owned()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment