1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Create query method

This commit is contained in:
2020-05-22 08:51:15 +02:00
parent ab5df69ee5
commit a67f988e1b
4 changed files with 207 additions and 2 deletions

28
src/data/error.rs Normal file
View File

@ -0,0 +1,28 @@
use core::fmt;
use serde::export::Formatter;
use std::error;
/// Simple rust error
///
/// @author Pierre Hubert
#[derive(Debug, Clone)]
pub struct ExecError(pub String);
impl ExecError {
pub fn new(msg: &str) -> ExecError {
ExecError(msg.to_string())
}
pub fn boxed_new(msg: &str) -> Box<ExecError> {
Box::new(ExecError(msg.to_string()))
}
}
impl fmt::Display for ExecError {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "Encountered error: {}", self.0)
}
}
impl error::Error for ExecError {}

View File

@ -1,3 +1,5 @@
pub mod error;
pub mod config;
pub mod http_error;
pub mod http_request_handler;
pub mod http_request_handler;