mirror of
https://github.com/CloudNebulaProject/wayray.git
synced 2026-04-10 21:20:40 +00:00
Add tracing and miette error infrastructure to wrsrvd
This commit is contained in:
parent
4e08dfb5a9
commit
2d68ab6e8d
2 changed files with 31 additions and 2 deletions
16
crates/wrsrvd/src/errors.rs
Normal file
16
crates/wrsrvd/src/errors.rs
Normal file
|
|
@ -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<dyn std::error::Error + Send + Sync>),
|
||||||
|
|
||||||
|
#[error("failed to initialize Wayland display")]
|
||||||
|
#[diagnostic(help("check that the XDG_RUNTIME_DIR environment variable is set"))]
|
||||||
|
DisplayInit(#[source] Box<dyn std::error::Error + Send + Sync>),
|
||||||
|
|
||||||
|
#[error("event loop error")]
|
||||||
|
EventLoop(#[source] Box<dyn std::error::Error + Send + Sync>),
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,16 @@
|
||||||
fn main() {
|
mod errors;
|
||||||
println!("wrsrvd compositor");
|
|
||||||
|
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(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue