Implemented settings for properties of reservation. Fixed bugs on empty database.

This commit is contained in:
2023-12-08 17:02:00 +01:00
parent d7e33e4342
commit 55ca93406a
14 changed files with 456 additions and 21 deletions
+23 -4
View File
@@ -1,15 +1,21 @@
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use leptos::ServerFnError;
#[derive(Debug, Eq, PartialEq)]
pub enum AppError {
HourParseError
HourParseError,
ServerError(String),
FatalError(String)
}
impl AppError {
fn as_string(&self) -> String {
//match self { AppError::HourParseError => {"Hour parse error"} }
"Hours parse error".to_string()
match self {
AppError::HourParseError => {"Hour parse error".to_string()},
AppError::ServerError(e) => {format!("Server error: {}", e)},
AppError::FatalError(e) => {format!("Fatal error: {}", e)}
}
}
}
@@ -19,4 +25,17 @@ impl Display for AppError {
}
}
impl Error for AppError {}
impl Error for AppError {}
impl From<ServerFnError> for AppError {
fn from(value: ServerFnError) -> Self {
AppError::ServerError(value.to_string())
}
}
#[cfg(feature = "ssr")]
impl From<sqlx::Error> for AppError {
fn from(value: sqlx::Error) -> Self {
AppError::FatalError(value.to_string())
}
}