Moved backend to it's own directory under project

This commit is contained in:
Marko Korhonen 2020-04-10 18:44:45 +03:00
parent c8a6acd07d
commit 36c58a89f7
No known key found for this signature in database
GPG key ID: 911B85FBC6003FE5
19 changed files with 0 additions and 0 deletions

View file

@ -1,33 +0,0 @@
use bcrypt::BcryptError;
use diesel::result;
use std::fmt;
pub enum CustomError {
HashError(BcryptError),
DBError(result::Error),
PasswordMatchError(String),
PasswordWrong(String),
}
impl From<BcryptError> for CustomError {
fn from(error: BcryptError) -> Self {
CustomError::HashError(error)
}
}
impl From<result::Error> for CustomError {
fn from(error: result::Error) -> Self {
CustomError::DBError(error)
}
}
impl std::fmt::Display for CustomError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
CustomError::HashError(error) => write!(f, "{}", error),
CustomError::DBError(error) => write!(f, "{}", error),
CustomError::PasswordMatchError(error) => write!(f, "{}", error),
CustomError::PasswordWrong(error) => write!(f, "{}", error),
}
}
}