Compare commits
4 Commits
e38fa9ac0e
...
353288bc05
| Author | SHA1 | Date | |
|---|---|---|---|
|
353288bc05
|
|||
|
5cbfa6ac9e
|
|||
|
f34aeafe0e
|
|||
|
1b8d382906
|
@@ -23,7 +23,12 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "server")]
|
#[cfg(feature = "server")]
|
||||||
fn main() {
|
fn main() -> std::process::ExitCode {
|
||||||
tracing_setup();
|
tracing_setup();
|
||||||
server::main()
|
|
||||||
|
if let Err(e) = server::main() {
|
||||||
|
tracing::error!("Server main failed:\n{e}");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::process::ExitCode::FAILURE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
use crate::App;
|
use crate::App;
|
||||||
|
use crate::util::error::Error;
|
||||||
|
use crate::server::config;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() -> Result<()> {
|
||||||
if let Err(e) = dotenvy::dotenv() {
|
if let Err(e) = dotenvy::dotenv() {
|
||||||
tracing::warn!("Error reading .env: {e}");
|
tracing::warn!("Error reading .env: {e}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tracing::debug!("Loading configuration...");
|
||||||
|
let config = config::load_config()
|
||||||
|
.map_err(|e| Error::message_here(e.to_string()))
|
||||||
|
.err_context("Failed to load config")?;
|
||||||
|
|
||||||
|
tracing::info!("Setup complete, launching web server...");
|
||||||
dioxus::launch(App);
|
dioxus::launch(App);
|
||||||
|
|
||||||
|
Err(Error::message_here("Web server exited"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,12 @@ impl Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a new basic `Error` at this location with the given message
|
||||||
|
#[track_caller]
|
||||||
|
pub fn message_here<S: Into<String>>(message: S) -> Self {
|
||||||
|
Error::new(ErrorType::Error(message.into()), ErrorLocation::here())
|
||||||
|
}
|
||||||
|
|
||||||
/// Adds a context message to the error
|
/// Adds a context message to the error
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn with_context(mut self, context: impl Into<String>) -> Self {
|
pub fn with_context(mut self, context: impl Into<String>) -> Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user