diff --git a/crates/wrsrvd/src/errors.rs b/crates/wrsrvd/src/errors.rs new file mode 100644 index 0000000..636dba2 --- /dev/null +++ b/crates/wrsrvd/src/errors.rs @@ -0,0 +1,16 @@ +use miette::Diagnostic; +use thiserror::Error; + +#[derive(Debug, Error, Diagnostic)] +pub enum WayRayError { + #[error("failed to initialize Winit backend")] + #[diagnostic(help("ensure a display server (X11 or Wayland) is running"))] + BackendInit(#[source] Box), + + #[error("failed to initialize Wayland display")] + #[diagnostic(help("check that the XDG_RUNTIME_DIR environment variable is set"))] + DisplayInit(#[source] Box), + + #[error("event loop error")] + EventLoop(#[source] Box), +} diff --git a/crates/wrsrvd/src/main.rs b/crates/wrsrvd/src/main.rs index d2d2ef2..f223222 100644 --- a/crates/wrsrvd/src/main.rs +++ b/crates/wrsrvd/src/main.rs @@ -1,3 +1,16 @@ -fn main() { - println!("wrsrvd compositor"); +mod errors; + +use miette::Result; +use tracing::info; + +fn main() -> Result<()> { + tracing_subscriber::fmt() + .with_env_filter( + tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")), + ) + .init(); + + info!("wrsrvd starting"); + Ok(()) }